Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Make 🖼 with SPM #roppongiswift/make_image_with_spm
Search
fromkk
May 23, 2018
Programming
2
1.8k
Make 🖼 with SPM #roppongiswift/make_image_with_spm
Roppongi.swift #3で発表してきた内容です。
Swift Package Managerで画像を生成する事にトライしました。
fromkk
May 23, 2018
Tweet
Share
More Decks by fromkk
See All by fromkk
note社の全員野球で品質向上活動について / note_qa_challenge #iOS_test_teatime
fromkk
3
1.8k
1年分のデータが見たいと言われてやったこと/yearly_data_with_note
fromkk
0
910
note iOSチームの自動化 ver.2021/automation_with_iOS_team_on_note_ver2021
fromkk
0
1.9k
Bitrise体験会説明資料/bitrise_explore
fromkk
1
1k
noteのiOSアプリで実装したアクセシビリティの全て #iosdc #a /a11y_with_iOS_App_on_note
fromkk
2
3.5k
dSYMのアップロードで SPMを活用する/use_spm_with_upload_dsyms
fromkk
1
2.7k
Bitriseのリモートアクセス機能 #bitrise_meetup/remote_access_of_bitrise
fromkk
1
530
note社でのMagic Pod活用事例 #af_iosdc/magicpod_with_note
fromkk
2
11k
iOSには無いmacOS独自機能をCatalystで実装する #iosdc #d/make_macos_apps_with_catalyst
fromkk
9
2k
Other Decks in Programming
See All in Programming
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
220
Amazon S3 NYJavaSIG 2024-12-12
sullis
0
130
Androidアプリの One Experience リリース
nein37
0
490
Cloudflare MCP ServerでClaude Desktop からWeb APIを構築
kutakutat
1
630
iOS開発におけるCopilot For XcodeとCode Completion / copilot for xcode
fuyan777
1
1.1k
PSR-15 はあなたのための ものではない? - phpcon2024
myamagishi
0
340
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
6
1.3k
menu基盤チームによるGoogle Cloudの活用事例~Application Integration, Cloud Tasks編~
yoshifumi_ishikura
0
130
shadcn/uiを使ってReactでの開発を加速させよう!
lef237
0
210
ATDDで素早く安定した デリバリを実現しよう!
tonnsama
1
610
命名をリントする
chiroruxx
1
540
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
380
Featured
See All Featured
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
3
220
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
How GitHub (no longer) Works
holman
312
140k
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
Building an army of robots
kneath
302
44k
Facilitating Awesome Meetings
lara
50
6.2k
What's in a price? How to price your products and services
michaelherold
244
12k
Agile that works and the tools we love
rasmusluckow
328
21k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.2k
How to Ace a Technical Interview
jacobian
276
23k
Transcript
Make ! with SPM Roppongi.swift #3 © fromkk 2018 1
Who is me? Kazuya Ueoka iOS application engineer in Timers
inc. Twitter: @fromkk Github: fromkk Qiita: fromkk © fromkk 2018 2
લఏ • macOS High Sierra • Xcode 9.3 © fromkk
2018 3
ݕ౼ͨ͠πʔϧ • Imagemagick • GD Graphics Library © fromkk 2018
4
ࠓճ GD Λར༻ © fromkk 2018 5
ԿނAppKitΘͳ͍ͷ͔ • GDͳΒLinux͔ΒͰར༻ग़དྷΔҝ © fromkk 2018 6
GDͷΠϯετʔϧ brew install gd © fromkk 2018 7
Swift͔ΒCݴޠͷϥΠϒϥϦΛར༻͢Δ © fromkk 2018 8
module.modulemap Λ࡞ mkdir ./GD && cd $_ touch module.modulemap ©
fromkk 2018 9
module.modulemap ༰ module GD [system] { header "/usr/local/include/gd.h" header "/usr/local/include/gdfontt.h"
header "/usr/local/include/gdfonts.h" header "/usr/local/include/gdfontl.h" header "/usr/local/include/gdfontg.h" header "/usr/local/include/gdfontmb.h" link "gd" export * } © fromkk 2018 10
ಉ͡֊ʹ Package.swift Λ࡞ import PackageDescription let package = Package( name:
"GD", pkgConfig: "gdlib", providers: [ .brew(["gd"]) ] ) © fromkk 2018 11
GitͰλά͚ git init . git add . git commit -m
"Initial commit" git tag 0.0.1 -m "Initial commit" © fromkk 2018 12
ϓϩδΣΫτΛ࡞ cd ../ && mkdir ./MyProject && cd $_ swift
package init --type executable © fromkk 2018 13
Package.swift Λฤू import PackageDescription let package = Package( name: "MyProject",
dependencies: [ .package(url: "../GD", from: "0.0.1"), ], targets: [ .target( name: "MyProject", dependencies: []), ] ) © fromkk 2018 14
ҰϏϧυ͢Δ swift build ↓ Fetching /PATH/TO/GD Cloning /PATH/TO/GD Resolving /PATH/TO/GD
at 0.0.1 Compile Swift Module 'MyProject' (1 sources) Linking ./.build/x86_64-apple-macosx10.10/debug/MyProject GD ͕ϑΣον͞ΕͯͪΌΜͱϏϧυ͞Ε͍ͯΔࣄΛ֬ೝ © fromkk 2018 15
XcodeprojΛ࡞ swift package generate-xcodeproj © fromkk 2018 16
ϑΥϧμߏ tree . . ├── GD │ ├── Package.swift │
└── module.modulemap └── MyProject ├── MyProject.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ └── fromkk.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ ├── xcshareddata │ │ └── xcschemes │ │ ├── MyProject-Package.xcscheme │ │ └── xcschememanagement.plist │ └── xcuserdata │ └── fromkk.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── Package.resolved ├── Package.swift ├── README.md ├── Sources │ └── MyProject │ └── main.swift └── Tests © fromkk 2018 17
GDͷجૅ © fromkk 2018 18
ը૾৽ن࡞ import GD let width: Int32 = 640 let height:
Int32 = 480 let image = gdImageCreateTrueColor(width, height) © fromkk 2018 19
ը૾อଘ import GD let handler = fopen("path/to/image.png", "wb") defer {
fclose(handler) } gdImagePng(image, handler) © fromkk 2018 20
ը૾߹ import GD let file = fopen("copy/image/path.png", "rb") defer {
fclose(file) } let copyImage = gdImageCreateFromPng(file) gdImageCopy(image, copyImage, dstX, dstY, srcX, srcY, width, height) © fromkk 2018 21
จࣈྻΛॻ͖ࠐΉ import GD let blackColor = gdImageColorAllocate(image, 0, 0, 0)
defer { gdImageColorDeallocate(image, blackColor) } let text = UnsafeMutablePointer<UInt8>(mutating: "hogehoge") gdImageString(image, gdFontGetSmall(), x, y, text, blackColor) © fromkk 2018 22
࡞ͬͯΈͨπʔϧ https://github.com/fromkk/TestSummaries XCTestͷUIςετͷ݁ՌΛΠΠײ͡Ͱݟ͍ͨ(Qiita) Πϯετʔϧํ๏ brew install fromkk/TestSummaries/testsummaries © fromkk 2018
23
Demo © fromkk 2018 24
݁Ռ © fromkk 2018 25
·ͱΊ • XCTestͰࡱͬͨεΫγϣΛը૾ʹ·ͱΊͯνʔϜʹڞ༗ग़ དྷΔ༷ʹ͠·ͨ͠ • Homebrew͔Β୭ͰΠϯετʔϧग़དྷ·͢ • ·ͩ·ͩաڈͷࢿ࢈Λ׆༻͢ΔࣄͰศརͳπʔϧ࡞ΕΔ © fromkk
2018 26
PR 1 © fromkk 2018 27
© fromkk 2018 28
© fromkk 2018 29
© fromkk 2018 30
PR 2 © fromkk 2018 31
https://pre-wwdc.connpass.com/event/83346/ © fromkk 2018 32
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ © fromkk 2018 33