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

iOSDC_SwiftUI_Text

Atsuya Sato
September 18, 2021

 iOSDC_SwiftUI_Text

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

Atsuya Sato

September 18, 2021
Tweet

More Decks by Atsuya Sato

Other Decks in Technology

Transcript

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

    4XJGU6*ʹQVCMJDTUBUJDGVOD  MIT5FYU SIT5FYU 5FYU ͕༻ҙ͞Ε͍ͯΔͷͰɺ͜͏͍͏ॻ͖ํ͕Ͱ͖Δ w J04ʙͰར༻Մೳ
  2. Text(Image(systemName: "heart")) .foregroundColor(.pink) + Text(" ") + Text("iOSDC").bold() + Text("

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

    ") + Text("Japan 2021") *NBHFΛ5FYUͰϥοϓ͢Δ w 4XJGU6*5FYUʹQVCMJDJOJU @JNBHF*NBHF  ͕༻ҙ͞Ε͍ͯΔͷͰɺ͜͏͍͏ॻ͖ํ͕Ͱ͖Δ w J04ʙͰར༻Մೳ
  4. จࣈྻิ׬Λ֦ுͨ͠ॻ͖ํ 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 Έ͍ͨͳॻ͖ํ΋Ͱ͖Δ
  5. จࣈྻิ׬Λ֦ுͨ͠ॻ͖ํͷิ଍ 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 ")
  6. จࣈྻิ׬Λ֦ுܻͨ۠͠੾Γ 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ܻͷϑΥʔϚοτʹͳΔ
  7. จࣈྻิ׬Λ֦ுܻͨ۠͠੾Γͷิ଍ 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ʹΑͬͯɺ਺஋ܕͷϑΥʔϚοτ͕ߦΘΕ͍ͯΔ