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

Swift Weekly 12/13

Johnlin
December 13, 2016

Swift Weekly 12/13

Johnlin

December 13, 2016
Tweet

More Decks by Johnlin

Other Decks in Programming

Transcript

  1. ະိSwift త޲Լ૬༰ • 3.X ൘ʢแؚ 3.1) ။׬શ૬༰ 3.0 ൘ɼୠੋ༗Մೳ။ Ճ૬༰త৽ޠ๏ɻ

    • Swift 4ฤᩄث။ଟҰݸჩᏐ -swift-version ༻ိඪ ࣔఔࣜᛰత Swift ൛ຊɻ څ 3 ब୅දੋ 3.X ൘ɼڅ 4 ब୅දੋ 4.X ൘ɻ
  2. ະိSwift త޲Լ૬༰ • 4.X ൘ ࿨ 3.X ൘త Swift library

    ሡՄҎࠞ༻ɻॴҎෆ ༻፦৺૬ґత౟݅ᔒ༗ঋڃɻ • Swift ౟݅؅ཧث။ଟҰݸબ߲ိࢦఆ૬༰త൛ຊɻ
  3. [SE-0145] ౟݅؅ཧث൛ຊݻఆ • ။ڣ Package.pins ࣕෆڣ Package.lock ੋҼҝ POSIX ༗

    lock, Thread ໵༗ lock • Package.pins త֬੾֨ࣜؐᔒ༗ܾఆɼ؃መ࡞ऀ૝ ༻ॄኄᒬత֨ࣜɻෆաେ֓ੋJSON
  4. [SE-0145] ౟݅؅ཧث൛ຊݻఆ • swift build • ೗Ռ༗ Package.pinsɼब᧋ཫ໘తࢦఆ൛ຊɻ • ᔒ༗

    Package.pinsɼ༻ Package.swift ိܾఆద ߹త൛ຊɼ࠶೺ࠣࢿ㘤ࣗಈሜਐ Package.pins
  5. [SE-0145] ౟݅؅ཧث൛ຊݻఆ • swift package pin --all #ݻఆݱ༗త൛ຊ • swift

    package pin Foo #ݻఆݱ༗తFoo൛ຊ • swift package pin Foo 1.2.3 #ݻఆFoo౸1.2.3൘ • swift package pin Foo 1.2.3 --message “1.2.4 is broken” #ݻఆFoo౸1.2.3൘ɼෟ্ݪҼ
  6. [SE-0145] ౟݅؅ཧث൛ຊݻఆ • swift package pin --enable-autopin 
 #⬏Ⴈሱọܥקđswift package

    update ޙ။ࣗಈݻ ఆ৽త൛ຊ • swift package pin --disable-autopin 
 #औফࣗಈݻఆɼswift package update ޙෆ။ࣗಈ ݻఆ৽త൛ຊ
  7. [SE-0145] ౟݅؅ཧث൛ຊݻఆ • swift package unpin --all 
 #औফॴ༗తݻఆɼ೗Ռࣗಈݻఆ։⬏త࿩။㗞ੜࡨ ޡ

    • swift package unpin Foo 
 #औফFooతݻఆɼ೗Ռࣗಈݻఆ։⬏త࿩။㗞ੜࡨ ޡ
  8. [SE-0146] ౟݅؅ཧثՄࣗగ㗞 ඼ let package = Package( name: "MyServer", targets:

    [ Target(name: "Utils"), Target(name: "HTTP", dependencies: ["Utils"]), Target(name: "ClientAPI", dependencies: ["HTTP", "Utils"]), Target(name: "ServerAPI", dependencies: ["HTTP"]), Target(name: "ServerDaemon", dependencies: ["ServerAPI"]), ], products: [ .Library(name: "ClientLib", type: .static, targets: ["ClientAPI"]), .Library(name: "ServerLib", type: .dynamic, targets: ["ServerAPI"]), .Executable(name: "myserver", targets: ["ServerDaemon"]), ] )
  9. [SE-0146] ౟݅؅ཧثՄࣗగ㗞 ඼ let package = Package( name: "MyClient", targets:

    [ Target(name: "ClientCLI", dependencies: [.product(name:"ClientAPI", package:"MyServer")]), ], products: [ .Executable(name: "myclient-cli", targets: ["ClientCLI"]), ] )