Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
わいわいSwift Package Manager
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
giginet
PRO
September 12, 2018
Programming
710
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
わいわいSwift Package Manager
https://iosdiscord.connpass.com/event/97606/
giginet
PRO
September 12, 2018
More Decks by giginet
See All by giginet
🀄️ on swiftc
giginet
PRO
0
630
15年メンテしてきたdotfilesから開発トレンドを振り返る 2011 - 2026
giginet
PRO
2
510
Claude Codeログ基盤の構築
giginet
PRO
7
4.8k
Inside of Swift Export
giginet
PRO
1
3.6k
Swiftビルド弾丸ツアー - Swift Buildが作る新しいエコシステム
giginet
PRO
0
3k
SwiftでMCPサーバーを作ろう!
giginet
PRO
3
500
Creating Intuitive Developer Tool in Swift
giginet
PRO
0
1.7k
Mergeable Libraryで 高速なアプリ起動を実現しよう!
giginet
PRO
2
8.7k
5分でわかるExplicitly Built Modules
giginet
PRO
2
2k
Other Decks in Programming
See All in Programming
Vapor Mode でアクセシビリティは 壊れないか検証した話
fuqda
1
330
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
420
プロジェクトコードをキレイキレイしよう!暗黙的な参照を読み解く静的解析
ostk0069
0
210
Python Lambdaにおけるテストしやすい設計とAI支援の活用 / Designing Testable Python Lambda Functions with AI
kitano_yuichi
1
300
ActionController meets Protocol Buffers
sorah
1
790
Modernizing iOS Apps
seyfoyun
0
150
AIが生成したコードは読むべきか?抽象化設計とコードの品質保証 / abstraction-design-and-quality
minodriven
16
8.8k
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
300
graphql-ruby を Spinel で速くしようとした話
mtsmfm
0
140
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
150
React Native経験者が Flutterを30⽇間触って驚いたこと
3saito
0
160
Railsバージョンを4倍にした話
optim
0
960
Featured
See All Featured
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
540
The SEO Collaboration Effect
kristinabergwall1
1
620
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
620
Reality Check: Gamification 10 Years Later
codingconduct
0
2.4k
RailsConf 2023
tenderlove
30
1.6k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.9k
A Tale of Four Properties
chriscoyier
163
24k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
Skip the Path - Find Your Career Trail
mkilby
1
290
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Transcript
Θ͍Θ͍Swift Package Manager Θ͍Θ͍swiftc #5 @giginet
Agenda • SPM System library • Package Description V4.2 •
How to develop
Motivation • App Store Connect APIΫϥΠΞϯτΛSwiftͰ࡞ͬͯͨ • ৄࡉiOSDC Reject Conference
Day1Ͱʂʂʂ • JSON Web TokenͷॲཧʹCͷϥΠϒϥϦΛ͍͔ͨͬͨ
System Library • ΄͔ͷύοέʔδϚωʔδϟʔͰೖΕͨStatic LibraryΛSPMͰ ఏڙ͢Δͭ
OpenSSL • https://github.com/IBM-Swift/OpenSSL . !"" LICENSE.txt !"" Package.swift !""
[email protected]
!"" README.md !"" module.modulemap #"" shim.h
module.modulemap • libssl, libcryptoʹlink module OpenSSL [system] { header "shim.h"
link "ssl" link "crypto" }
shim.h #ifndef OpenSSLHelper_h #define OpenSSLHelper_h #include <openssl/conf.h> #include <openssl/evp.h> #include
<openssl/err.h> #include <openssl/bio.h> #include <openssl/ssl.h> #include <openssl/md4.h> #include <openssl/md5.h> #include <openssl/sha.h> #include <openssl/hmac.h> #include <openssl/rand.h> #include <openssl/pkcs12.h> #include <openssl/x509v3.h> // (ry
Package.swift import PackageDescription let package = Package( name: "OpenSSL", providers:
[ .apt(["openssl libssl-dev"]), .brew(["openssl"]), ], products: [ .library( name: "OpenSSL", targets: ["OpenSSL"] ) ], targets: [ .target(name: "OpenSSL") ] )
How to init modulemap $ swift package init --type modulemap
How to use • .packageͰଞͷύοέʔδͱಉ͡Α͏ʹΈࠐΊΔ • Swift͔Β؆୯ʹCͷAPIୟ͚Δ import PackageDescription let
package = Package( name: "Wormhole", products: [ .library( name: "Wormhole", targets: ["Wormhole"]), ], dependencies: [ .package(url: "https://github.com/giginet/libjwt-swift.git", from: "1.0.0"), ], targets: [ .target( name: "Wormhole", dependencies: ["Result", "JWT"]), ] )
libjwt-swift • https://github.com/giginet/libjwt-swift • JWTΛѻ͏CϥΠϒϥϦΛSwift͔Β͔ͭ͑ΔΑ͏ʹౕͨ͠
! import Foundation import JWT struct JWTEncoder { func encode(issuerID:
UUID, keyID: String) throws -> String { let object = UnsafeMutablePointer<OpaquePointer?>.allocate(capacity: MemoryLayout<OpaquePointer>.size) jwt_new(object) defer { jwt_free(object.pointee) } let keyPointer = convertToCString(privateKey) defer { keyPointer.deallocate() } jwt_set_alg(object.pointee, JWT_ALG_ES256, keyPointer, Int32(privateKey.utf16.count + 1)) // https://github.com/benmcollins/libjwt/pull/71 jwt_add_header(object.pointee, "kid", keyID) jwt_add_grant(object.pointee, "iss", issuerID.uuidString.lowercased()) let expirationDate = Date().addingTimeInterval(expirationInterval) jwt_add_grant_int(object.pointee, "exp", Int(expirationDate.timeIntervalSince1970)) jwt_add_grant(object.pointee, "aud", "appstoreconnect-v1") guard let encodedCString = jwt_encode_str(object.pointee) else { throw Error.decodeError } return String(cString: encodedCString) } }
Deprecation • Xcode beta 6ͷToolchainͩͱͳ͘ಈ͘ • DEVELOPMENT SNAPSHOT(9/8ݱࡏ)ͩͱwarningग़Δ
None
ࠓ·Ͱͷ4.2͔Βdeprecatedͳ ͷͰΕ͍ͯͩ͘͞
System Library(>=4.2) • SPM Package Description v4.2͔ΒSystem Library͕αϙʔτ • System
LibraryΛύοέʔδ͔ΒࢀরͰ͖ΔΑ͏ʹ • https://github.com/apple/swift-package-manager/blob/master/ Documentation/PackageDescriptionV4_2.md
How to Use • .systemLibraryͷଘࡏυΩϡϝϯτʹॻ͍ͯ͋Δ • ͍ํͷυΩϡϝϯτ͕ͳ͍ • ॻ͖͔͚ͷυΩϡϝϯτ͕Ϛʔδ͞Εͯͳ͍ঢ়ଶͰൃݟ͞Εͨ •
https://github.com/apple/swift-package-manager/blob/ 40d319d7bb1a8cb42b187a4cbfa72515c61ebc44/ Documentation/Usage.md
Directories Sources !"" jwt #"" jwt.h !"" module.modulemap
// swift-tools-version:4.2 // The swift-tools-version declares the minimum version of
Swift required to build this package. import PackageDescription let package = Package( name: "Wormhole", products: [ .library( name: "Wormhole", targets: ["Wormhole"]), ], targets: [ .systemLibrary(name: "JWT", path: "./Sources/jwt", providers: [.brew(["libjwt"]), .apt(["libjwt"])]), .target( name: "Wormhole", dependencies: ["Result", "JWT"]), ] )
Local Package • PD v4.2͔ΒϩʔΧϧύεͰͷdependencyʹରԠ import PackageDescription let package =
Package( name: "MyPackage", dependencies: [ .package(path: "../example-package-playingcard"), ], targets: [ .target( name: "MyPackage", dependencies: ["PlayingCard"] ), ] )
Achievement • ~ͷల։͕όά͍ͬͯͨͷͰࡢͨ͠ • https://github.com/apple/swift-package-manager/pull/1779 $ swift build --disable-package-manifest-caching error:
/Users/giginet/work/myexecutable/~/work/MyPackage has no manifest 'myexecutable' /Users/giginet/work/myexecutable: error: product dependency 'MyPackage' not found
Starting SPM development
SPM • SwiftͰ։ൃՄೳ • llbuildC++ • ͪΐͬͱPython(2) • Ϗϧυͷཱྀ͕ͳ͍ •
ϏϧυࡁΈToolchainΛ͑ྑ͍ • SPMͱswift-llbuild͚ͩඞཁ
Bootstrap • Documentation/Development.mdͱREADME.mdΛಡΉ • ͦΕͰएׯϋϚΔ
Select Toolchain • /Library/Developer/Toolchains/swift-latest.xctoolchain/ Info.plistΛݟΔ • CFBundleVersionͷΛڥมͰ͢ $ export TOOLCHAINS=org.swift.4220180908a
Build $ ./Utilities/bootstrap --verbose
Use development SPM #!/usr/bin/env bash /path/to/swift-source/swiftpm/.build/debug/spm "$@"
Xcode $ ./Utilities/bootstrap --generate-xcodeproj generated: ./SwiftPM.xcodeproj $ open SwiftPM.xcodeproj
LLDB • Xcode > Debug > Attach to Process by
PID or Name...
Next • ManifestͷύʔαʔͰόάݟ͚ͭͨͷͰۙʑ͢༧ఆ • ։ൃڥͰDynamic FrameworkͷLinkʹࣦഊ͢Δ • swift-llbuild৮ͬͯΈΔ
Wormhole • ϥΠϒϥϦ࡞ͬͯexecutableͰ͏ࢀߟྫ • https://github.com/giginet/Wormhole • iOS Reject Conference Day1Ͱ͢༧ఆ
• https://iosdc-reject-conference.connpass.com/event/93314/
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠