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.9k
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.9k
1年分のデータが見たいと言われてやったこと/yearly_data_with_note
fromkk
0
970
note iOSチームの自動化 ver.2021/automation_with_iOS_team_on_note_ver2021
fromkk
0
2k
Bitrise体験会説明資料/bitrise_explore
fromkk
1
1.1k
noteのiOSアプリで実装したアクセシビリティの全て #iosdc #a /a11y_with_iOS_App_on_note
fromkk
2
3.9k
dSYMのアップロードで SPMを活用する/use_spm_with_upload_dsyms
fromkk
1
2.9k
Bitriseのリモートアクセス機能 #bitrise_meetup/remote_access_of_bitrise
fromkk
1
580
note社でのMagic Pod活用事例 #af_iosdc/magicpod_with_note
fromkk
2
11k
iOSには無いmacOS独自機能をCatalystで実装する #iosdc #d/make_macos_apps_with_catalyst
fromkk
9
2.1k
Other Decks in Programming
See All in Programming
PHPUnitの限界をPlaywrightで補完するテストアプローチ
yuzneri
0
270
はじめてのWeb API体験 ー 飲食店検索アプリを作ろうー
akinko_0915
0
160
slogパッケージの深掘り
integral0515
0
130
SwiftでMCPサーバーを作ろう!
giginet
PRO
2
190
なぜあなたのオブザーバビリティ導入は頓挫するのか
ryota_hnk
1
370
商品比較サービス「マイベスト」における パーソナライズレコメンドの第一歩
ucchiii43
0
200
ソフトウェア設計とAI技術の活用
masuda220
PRO
25
6.7k
NEWT Backend Evolution
xpromx
1
150
ISUCON研修おかわり会 講義スライド
arfes0e2b3c
1
480
おやつのお供はお決まりですか?@WWDC25 Recap -Japan-\(region).swift
shingangan
0
150
Vibe Codingの幻想を超えて-生成AIを現場で使えるようにするまでの泥臭い話.ai
fumiyakume
18
9.2k
初学者でも今すぐできる、Claude Codeの生産性を10倍上げるTips
s4yuba
16
13k
Featured
See All Featured
Building Adaptive Systems
keathley
43
2.7k
KATA
mclloyd
30
14k
Building an army of robots
kneath
306
45k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
Reflections from 52 weeks, 52 projects
jeffersonlam
351
21k
A better future with KSS
kneath
238
17k
4 Signs Your Business is Dying
shpigford
184
22k
RailsConf 2023
tenderlove
30
1.2k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
60k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.6k
GitHub's CSS Performance
jonrohan
1031
460k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
130
19k
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