Upgrade to Pro — share decks privately, control downloads, hide ads and more …

iOSDC_SwiftUI_Text

8db1f2958e24accef8412659656fc8dc?s=47 Atsuya Sato
September 18, 2021

 iOSDC_SwiftUI_Text

iOSDC Japan 2021でLT登壇した資料です

8db1f2958e24accef8412659656fc8dc?s=128

Atsuya Sato

September 18, 2021
Tweet

Transcript

  1. "UTVZB4BUP 4XJGU6*5FYUΛ࢖͍͜ͳ͢෼ؒ J04%$+BQBO%BZ-5

  2. J04%$+BQBO Ұ෦෼͚ͩ #PMEͷςΩετ Ͳ͏࣮૷͢Δʁ

  3. HStack(spacing: 8) { Text("iOSDC").bold() Text("Japan 2021") } ۪௚ʹ)4UBDLΛ࢖ͬͯ J04%$+BQBO

  4. HStack(spacing: 8) { Text("Hello, iOSDC!").bold() Text("௕͍௕͍௕͍௕͍ςΩετ") } )FMMP J04%$ ௕͍௕͍௕͍

    ௕͍ςΩετ
  5. Text("iOSDC").bold() + Text(" ") + Text("Japan 2021") ͜͏͍͏෩ʹ΋ॻ͚Δ J04%$+BQBO

  6. Text("Hello, iOSDC!").bold() + Text(" ") + Text("௕͍௕͍௕͍௕͍ςΩετ") )FMMP J04%$௕͍௕͍௕ ͍௕͍ςΩετ

  7. 5FYUΛ ԋࢉࢠͰ݁߹͢Δ Text("iOSDC").bold() + Text(" ") + Text("Japan 2021") w

    4XJGU6*ʹQVCMJDTUBUJDGVOD  MIT5FYU SIT5FYU 5FYU ͕༻ҙ͞Ε͍ͯΔͷͰɺ͜͏͍͏ॻ͖ํ͕Ͱ͖Δ w J04ʙͰར༻Մೳ
  8. J04%$+BQBO *NBHFͱ5FYUͷηοτ ύλʔϯ

  9. Text(Image(systemName: "heart")) .foregroundColor(.pink) + Text(" ") + Text("iOSDC").bold() + Text("

    ") + Text("Japan 2021") ͖ͬ͞ͷԠ༻ͯ͜͠͏ॻ͚Δ J04%$+BQBO
  10. Text(Image(systemName: "heart")) .foregroundColor(.pink) + Text(" ") + Text("iOSDC").bold() + Text("

    ") + Text("Japan 2021") *NBHFΛ5FYUͰϥοϓ͢Δ w 4XJGU6*5FYUʹQVCMJDJOJU @JNBHF*NBHF  ͕༻ҙ͞Ε͍ͯΔͷͰɺ͜͏͍͏ॻ͖ํ͕Ͱ͖Δ w J04ʙͰར༻Մೳ
  11. Text(" \(Text(Image(systemName: "heart")) .foregroundColor(.pink))□ \(Text("iOSDC").bold())□ Japan□2021 ") ͞Βʹ͜͏͍͏෩ʹ΋ॻ͚Δ ˞දࣔྖҬͷؔ܎ͰվߦΛೖΕͯɺۭനΛ˘ʹ͍ͯ͠·͢ J04%$+BQBO

  12. จࣈྻิ׬Λ֦ுͨ͠ॻ͖ํ w ͬ͘͟Γݴ͏ͱɺ4XJGU6*Ͱఆٛ͞Ε͍ͯΔQVCMJDNVUBUJOHGVOD BQQFOE*OUFSQPMBUJPO @UFYU5FYU ʹΑͬͯՄೳʹͳ͍ͬͯΔॻ͖ํ w J04ʙͰར༻Մೳ Text(" \(Text(Image(systemName:

    "heart")) .foregroundColor(.pink))□ \(Text("iOSDC").bold())□ Japan□2021 ") w ͪͳΈʹ QVCMJDNVUBUJOHGVODBQQFOE*OUFSQPMBUJPO @JNBHF*NBHF ΋༻ҙ͞Ε͍ͯΔͷͰ w 5FYU a *NBHF TZTUFN/BNFBQQMFMPHP "QQMF Έ͍ͨͳॻ͖ํ΋Ͱ͖Δ
  13. จࣈྻิ׬Λ֦ுͨ͠ॻ͖ํͷิ଍ w 4XJGU6*5FYU͸QVCMJDJOJU @LFZ-PDBMJ[FE4USJOH,FZ UBCMF/BNF4USJOH OJM  CVOEMF#VOEMF OJM DPNNFOU4UBUJD4USJOH

    OJM ΛΠχγϟϥΠβͱ͍ͯ࣋ͬͯ͠ Δ w 5FYU J04%$ ͷΑ͏ʹॻ͍ͨ࣌ʹJ04%$ͷܕ͸-PDBMJ[FE4USJOH,FZʹͳΔ w -PDBMJ[FE4USJOH,FZ͸&YQSFTTJCMF#Z4USJOH*OUFSQPMBUJPOʹ४ڌ͢ΔܕͰ 4USJOH*OUFSQPMBUJPO1SPUPDPMʹ४ڌͨ͠ܕ4USJOH*OUFSQPMBUJPOΛ಺෦తʹ͍࣋ͬͯΔ w 4XJGU6*ʹఆٛ͞ΕͨBQQFOE*OUFSQPMBUJPOʹΑͬͯΧελϚΠζ͞Εͨจࣈྻิ׬Λར ༻Ͱ͖Δ Text(" \(Text(Image(systemName: "heart")) .foregroundColor(.pink))□ \(Text("iOSDC").bold())□ Japan□2021 ")
  14. ߹ܭ ԁ ܻ۠੾Γจࣈྻ΋ ͍͍ײ͡ʹʜ

  15. Text("߹ܭ \(amount)ԁ") ܻ۠੾Γจࣈྻͷදࣔ͸/VNCFS'PSNBUUFSແ͠Ͱ͍͍ ߹ܭ ԁ

  16. จࣈྻิ׬Λ֦ுܻͨ۠͠੾Γ w ͬ͘͟Γݴ͏ͱɺ4XJGU6*Ͱఆٛ͞Ε͍ͯΔQVCMJDNVUBUJOHGVOD BQQFOE*OUFSQPMBUJPO5 @WBMVF5 XIFSF5@'PSNBU4QFDJpBCMFʹΑ ͬͯՄೳʹͳ͍ͬͯΔॻ͖ํ w J04ʙͰར༻Մೳ Text("߹ܭ

    \(amount)ԁ")) w ͪͳΈʹ QVCMJDNVUBUJOHGVODBQQFOE*OUFSQPMBUJPO5 @WBMVF5 TQFDJpFS4USJOH XIFSF 5@'PSNBU4QFDJpBCMFΛ༻͍ͯϑΥʔϚοτࢦఆ͢Δ͜ͱ΋Մೳ • Text("\(pi, specifier: “%.2f")") ͷΑ͏ʹॻ͘ͱখ਺఺Լ2ܻͷϑΥʔϚοτʹͳΔ
  17. จࣈྻิ׬Λ֦ுܻͨ۠͠੾Γͷิ଍ Text("߹ܭ \(amount)ԁ")) w ࢓૊Έ͸ઌ΄Ͳઆ໌ͨ͠BQQFOE*OUFSQPMBUJPOʹΑΔจࣈྻิ׬ͷ֦ு public protocol _FormatSpecifiable : Swift.Equatable

    { associatedtype _Arg : Swift.CVarArg var _arg: Self._Arg { get } var _specifier: Swift.String { get } } w *OU΍%PVCMFͳͲͷ਺஋ܕ͕@'PSNBU4QFDJpBCMFʹ४ڌ͓ͯ͠Γɺࢦఆ͞ Εͨ@TQFDJpFSʹΑͬͯɺ਺஋ܕͷϑΥʔϚοτ͕ߦΘΕ͍ͯΔ
  18. 'SJ  &BSMZ#JSE 4VQQPSUFS BOE3FHVMBS ͪͳΈʹɺJ04͔Β͸'PSNBU4UZMF΋ར༻Մೳʹ

  19. Text(iOSDC2021.startedAt, format: .dateTime .month(.defaultDigits) .day() .weekday() ) ͪͳΈʹɺJ04͔Β͸'PSNBU4UZMF΋ར༻Մೳʹ 'SJ 

    &BSMZ#JSE 4VQQPSUFS BOE3FHVMBS Text(iOSDC2021.ticketKinds, format: .list(type: .and) )
  20. 4XJGU6*5FYUͰ'PSNBU4UZMFΛ࢖͏ w 4XJGU6*5FYUʹ༻ҙ͞Ε͍ͯΔQVCMJDJOJU' @JOQVU''PSNBU*OQVU GPSNBU'  XIFSF''PSNBU4UZMF ''PSNBU*OQVU&RVBUBCMF ''PSNBU0VUQVU4USJOHΛ ར༻Ͱ͖Δ

    w J04ʙͰར༻Մೳ
  21. w 5XJUUFS!O@BUNBSL w ॴଐΫοΫύουגࣜձࣾ w ΫοΫύουΞϓϦ J04"OESPJE ͷ։ൃ ࣗݾ঺հ ࠤ౻ರ໵

    ͋ͭ΍