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

Swift weekly 2018/09/04

3f7d9611fc919c98512b779cde637dfc?s=47 Johnlin
September 04, 2018

Swift weekly 2018/09/04

3f7d9611fc919c98512b779cde637dfc?s=128

Johnlin

September 04, 2018
Tweet

Transcript

  1. Swift पใ 2018/09/04 John Lin @johnlinvc

  2. From the core • Swift 5: Start your engines

  3. Swift 5: Start your engines • Release date: Late 2018

    • ໨ඪ: ABI stability (again) ɼแؚ generic, API resilience, memory ownership model • ။޲Լ૬༰ 4
  4. Evolution • [SE-0220] count(where:) • [SE-0224] Support 'less than' operator

    in compilation conditions • [SE-0225] isEven, isOdd, isMultiple • [SE-0226] Package Manager Target Based Dependency Resolution
  5. [SE-0220] count(where:) • ཁዎᒬᏐ [1,2,3,4,5,6,7] ཫ໘༗ଟগۮᏐ䏆ʁ [1,2,3,4,5,6,7].filter { $0 %

    2 == 0 }.count • Ṝᒬతሜ๏ଖመ䋯తൺֱຫɼfilter ။ઌ䋯Ұ࣍᫮ ᅲɼ count ။࠶䋯Ұ࣍
  6. [SE-0220] count(where:) [1,2,3,4,5,6,7].reduce(0) { $0 + ($1 % 2 ==

    0 ? 1 : 0) } • Ṝᒬతሜ๏䋯తൺֱշɼୠੋ኷೉䔟㣛ੋࡏ၏ॄኄɻ
  7. [SE-0220] count(where:) var count = 0 for n in [1,2,3,4,5,6,7]

    { count += n % 2 == 0 ? 1 : 0 } • ࿨ reduce Ұᒬշɼෆա޷௕ɻ
  8. [SE-0220] count(where:) [1,2,3,4,5,6,7].count{$0 % 2 == 0} • ৽⃧ Sequence#countɼ䋯ىိ࿨

    reduce Ұᒬշɼ ෆաൺֱ໌֬ɻ
  9. [SE-0224] Support 'less than' operator in compilation conditions #if swift(>=5.0)

    print("this is 5.0") #endif • ݱࡏՄҎ༻্໘తํ๏ိ൑Ꮧ Swift ൛ຊ • ෆա୞ೳ༻ >=ɼཁখԙ୞ೳ༻ ! ိᒾҰෆੋ >= #if !swift(>=5.0) print("this is not 5.0") #endif
  10. [SE-0224] Support 'less than' operator in compilation conditions #if swift(<5.0)

    print("this is not 5.0") #endif • ೭ޙՄҎ༻ < ိ൑Ꮧ Swift ൛ຊ
  11. [SE-0225] isEven, isOdd, isMultiple • ᧷ಘ㑌࣍౎ཁሜ n % 2 ==

    0 ኷൥䆩ʁ • େՈ᧷ಘ -3 % 2 ੋଟগ䏆ʁ
  12. [SE-0225] isEven, isOdd, isMultiple • ༗ਓఏҊཁՃ n.isEven, n.isOdd, n.isMultiple(of:) •

    ࠷ޙ୞༗ n.isMultiple(of:) ௨աɼ။Ճ౸ Swift 5 ཫɻ • ֩৺ᅶୂ᧷ಘ isEven Ṝछ؆ᄸతେՈࣗݾሜब޷ɻ ر๬ೳ೺ޠݴతද໘ੵେখ߇੍޷ɻ
  13. [SE-0226] Package Manager Target Based Dependency Resolution • Ұݸ Package

    ཫ໘ৗৗ༗኷ଟෆಉ target, 㑌ݸ target ౎༗֤ࣗత dependencyɻݱࡏ༻ྃҰݸ Package ब။೺ॴ༗త dependency ౎፛ਐိɼ೭ ޙ୞။፛༗༻౸త targetɻ
  14. ૓ྛ [SE-0226] Package Manager Target Based Dependency Resolution ߳া ᘈᘈ

    ᘆࢠ थ
  15. ૓ྛ [SE-0226] Package Manager Target Based Dependency Resolution ߳া ᘈᘈ

    ᘆࢠ थ
  16. Community • 㟬ঋڃ iOS beta ྃ䆩ʁ • 㟬ใ໊ iplayground ྃ䆩ʁ

  17. iOS 12 beta upgrade •

  18. iPlayground • https://iplayground.io 10/20(࿡)-21(೔ʣ • ݱਖ਼ᄧථɼ㐸ߘதɻ