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

シン・スウィフト 5.7 ~ Swift5.7を振り返る ~ / New Swift 5.7

シン・スウィフト 5.7 ~ Swift5.7を振り返る ~ / New Swift 5.7

「シン・スウィフト 5.7 ~ Swift5.7を振り返る ~」登壇:freddi 監修:shinzan

※こちらは以下イベントの資料です
https://yj-meetup.connpass.com/event/247614/

LINE Developers

June 07, 2022
Tweet

More Decks by LINE Developers

Other Decks in Technology

Transcript

  1. γ ϯ ɾ ε ΢ Ο ϑ τ S W

    I F T: 5.7 ొஃGSFEEJ؂मTIJ[ ʙ۩ମྫͰֶͿɺ4XJGU͔Βͷzܕz͍ͭͯʙ 88%$&YUFOEFE5PLZP +VOFUI 
  2. &YJTUFOUJBM$POUBJOFS w ʮಉ͡ϓϩτίϧಉ࢜ʯͱ͍͏ಛੑΛ࣮ݱ͢ΔzೖΕ෺z w ࣮ߦ࣌ʹಇ͘ͷͰɺ͍··ͰͷίʔυͰͷҙࣝ͸ബ͍ struct A: P {}; struct

    B: P {} var value: P = A() value = B() ͜ͷ1͸ଘࡏܕ #͸1ʹ४ڌͯ͠ΔͷͰ0, WBMVF͸ଘࡏܕ1Ͱ͋Γɺ1ͷܕΛड͚ೖΕΔίϯςφ 4&
  3. 4XJGU͔ΒͷBOZ w ྫ͑͹ҎԼͷΑ͏ͳ"SSBZ΋ॻ͚Δ class A: P { typealias T =

    Int } class B: P { typealias T = Double } let array: [any P] = [A(), B()] 4&
  4. ͜Ε͔ΒͷTPNFͦͷ̎ʢ4XJGUdʣ w XIFSFʹΑΔBTTDPDJBUFEUZQFͷ੍໿͕ඞཁͳ͍ w TPNFʹΑΔ੍໿Ͱ΋े෼ͳͷͰ͸ͳ͍͔ w δΣωϦΫεͷಛघԽʹΑΔσϝϦοτ someFunc(arg1: A, arg2:

    B) someFunc(arg1: B, arg2: B) someFunc(arg1: B, arg2: A) ͜ͷΑ͏ͳίʔϧΛͨ͠৔߹ ͭ෼ͷTPNF'VODͷ࣮૷͕ίϯύΠϧ࣌ʹੜ੒ ಛघԽ  ΞϓϦͷαΠζ͕ͪΐͬͱ૿͑Δ͔΋ 4&
  5. "1*3FRVFTUͷܕύϥϝʔλΛར༻ͨؔ͠਺ w ҎԼͷΑ͏ʹͳΔʢ࣮૷͸΄΅ಉ͡Ͱྑ͍ʣ w ͋·ΓมΘͬͯͳ͍Α͏ʹ΋ݟ͑Δ͕ʜ func get<Request: APIRequest>(_ request: Request)

    async throws -> Request.Response ↓ func get<Response>(_ request: some APIRequest<Response>) async throws -> Response