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

Swift 5 Exclusivity Enforcement

darquro
February 12, 2019

Swift 5 Exclusivity Enforcement

darquro

February 12, 2019
Tweet

More Decks by darquro

Other Decks in Technology

Transcript

  1. Re:valua t ion https://fril.jp/ L ead & Delight User F

    irst Ownership Fail Smart 4XJGU&YDMVTJWJUZ&OGPSDFNFOU 'FCUI BU4XJGUѪ޷ձWPM
  2.   #BDLHSPVOE func modifyTwice(_ value: inout Int, by modifier:

    (inout Int) -> ()) { modifier(&value) modifier(&value) } func testCount() { var count = 1 modifyTwice(&count) { $0 += count } print(count) }
  3.   #BDLHSPVOE func modifyTwice(_ value: inout Int, by modifier:

    (inout Int) -> ()) { modifier(&value) modifier(&value) } func testCount() { var count = 1 modifyTwice(&count) { $0 += count } print(count) } 0WFSMBQQJOHBDDFTTFTUPDPVOU CVUNPEJpDBUJPOSFRVJSFTFYDMVTJWF BDDFTTDPOTJEFSDPQZJOHUPBMPDBMWBSJBCMF
  4.   #BDLHSPVOE 4XJGU 4XJGU $PNQJMFUJNF %FCVH#VJME 3FMFBTF#VJME %FCVH#VJME 3FMFBTF#VJME

    3VOUJNF %FCVH#VJME %FCVH#VJME 3FMFBTF#VJME ഉଞతϝϞϦΞΫηεͷEFGBVMUઃఆ
  5.   *NQBDUPO4XJGU1SPKFDUT طଘϓϩδΣΫτ΁ͷӨڹ w ഉଞϧʔϧʹҧ൓͍ͯͯ͠ɺσόοάςετͰ࣮ߦͰ ͖ͳ͔ͬͨίʔυʹରͯ͠Ϋϥογϡ͢ΔՄೳੑ w ύϑΥʔϚϯεʹӨڹ͕ͰΔՄೳੑ͕͋Δɻ w

    ಛʹϧʔϓॲཧʹ͓͍ͯҟͳΔΦϒδΣΫτؒͰΞΫηε͢Δ৔߹ʹ஫ҙ͢Δɻ w ΫϥεͷϓϩύςΟͳͲ͸QSJWBUFͱ͔JOUFSOBMʹ͢Δ͜ͱͰίϯύΠϥʹ໌ࣔతʹ఻ ͑ΔͳͲ͕ඞཁɻ
  6.   &YBNQMF func modifyTwice(_ value: inout Int, by modifier:

    (inout Int) -> ()) { modifier(&value) modifier(&value) } func testCount() { var count = 1 let incrementBy = count modifyTwice(&count) { $0 += incrementBy } print(count) }
  7.   &YBNQMF func modifyTwice(_ value: inout Int, by modifier:

    (inout Int) -> ()) { modifier(&value) modifier(&value) } var count = 1 modifyTwice(&count) { $0 += count } print(count) 4JNVMUBOFPVTBDDFTTUPY CVUNPEJpDBUJPOSFRVJSFTFYDMVTJWFBDDFTT