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

Swift Weekly 2017-09-05

Johnlin
September 05, 2017

Swift Weekly 2017-09-05

Johnlin

September 05, 2017
Tweet

More Decks by Johnlin

Other Decks in Programming

Transcript

  1. From the core • Swift 4 : End game •

    Swift 5 : Start your engine • Swift refactor ޻۩։ݯ
  2. Swift 5 : Start your engine • ։࢝։ᚙ Swift 5

    • ओཁ໨ඪ: ᜦఆ ABI(application binary interface) • ॴ༗࿨ ABI ༗᮫త౦੢౎धཁ၏׬ɼแؚɿ • ߋڧత Generic: ૾ੋ recursive protocol • ڧ݈త API: ᩋ API ࡏ ABI ෆᏓత৘گԼਐߦमվ • Memory Ownership model: (opt-in) Rust ෩֨తهԱᱪ؅ཧɼᩋ Ꮘೳߋߴɻ
  3. Swift 5 : Start your engine • ࣍ཁ໨ඪ: • ߋූ߹ਓᱪ޻ላత

    String: ໨ඪੋ㐝ഊ Perl • վਐ std lib: ᩋଞߋ޷༻Ұᴍ • վਐ Foundation: ݱࡏؐ༗Ұථᔒಘ༻ • ৽⃧ޠ๏ɿᔒඞཁෆ။վɼ೗Ռ኷޷త࿩ؐੋ။վ • ҝ৽తconcurrent model ฯ࿏ : ୠੋᔒ༗ཁ၏౸׬ɻ
  4. Swift 5 : Start your engine • ࿨ Swift 4

    ҰᒬɼSwift 5 ՄҎબ Swift 4 ໛ࣜɻఔࣜ ᛰ׬શ૬༰ɻෆաෆอᨽೳࢧԉ Swift 3ɻ 2018 ೥ॳ ။֬ೝೳෆೳࢧԉ 3. • Coming Soooon at 2018 ೥຤
  5. [SE-0185] ࣗಈ߹੒ Equatable ᢛ Hashable • ݱࡏཁᩋࣗݾత struct/class ՄҎ༻ ==

    ༗ᴍຑ൥ struct Point : Equatable { let x : Double let y : Double init(x:Double, y:Double ) { self.x = x self.y = y } static func ==(lhs: Point, rhs: Point) -> Bool { return lhs.x == rhs.x && lhs.y == rhs.y } }
  6. [SE-0185] ࣗಈ߹੒ Equatable ᢛ Hashable • ݱࡏཁᩋࣗݾత struct ՄҎ༻ ==

    ༗ᴍຑ൥ struct Point : Equatable { ... static func ==(lhs: Point, rhs: Point) -> Bool { return lhs.x == rhs.x && lhs.y == rhs.y } } એࠂ׬࠽ೳ༻ == ҃ != let a = Point(x: 0, y: 0) let b = Point(x: 1, y: 1) a == a // true a != b // true
  7. [SE-0185] ࣗಈ߹੒ Equatable ᢛ Hashable • 㑌Ұݸ struct ౎ཁ༗ 


    static func ==(lhs: Point, rhs: Point) -> Bool { return lhs.x == rhs.x && lhs.y == rhs.y } • ୠੋ㚎༰౎େಉখҟɼबੋ೺㑌Ұݸ property ౎ compare Ұ࣍ɻ
  8. [SE-0185] ࣗಈ߹੒ Equatable ᢛ Hashable • ೭ޙՄҎ୞ཁ conform Equatable ब။ࣗಈ㗞ੜ


    static func ==(lhs: Point, rhs: Point) -> Bool {} • ཫ໘။೺㑌ݸ property ౎ൺֱҰ࣍ɻ • ෆ။ሣݱ༗త code ༗Өڹɻ ᔒ༗ confrom తबෆ။༗Ꮘ Ռɻ • ࢧԉ struct ࿨ enum , ෆࢧԉ class , tuple • Hashable ໵Ұᒬ။ࣗಈ㗞ੜɼᩋࢧԉ dict Ꮣಘߋ؆ᄸ
  9. Community • Chris Lattner 䋯ڈ Google ྃɻ଴ۀత࣌ީҾᚙྃ concurrency େፌɻ •

    https://gist.github.com/lattner/ 31ed37682ef1576b16bca1432ea9f782