Slide 1

Slide 1 text

SwiftPM - ίϚϯυϥΠϯ πʔϧೖ໳ #potatotips41

Slide 2

Slide 2 text

ࣗݾ঺հ • Takeshi Ihara • Recruit Marketing Partners • iOS Engineer • Twitter: @nonchalant0303 • GitHub: @Nonchalant

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

͜ͷ࡞ۀΊΜͲ͏͡Όͳ͍Ͱ͔͢ʁ

Slide 5

Slide 5 text

https://github.com/Nonchalant/AppIcon ΞΠίϯͷղ૾౓ผॻ͖ग़͠πʔϧΛϦϦʔε͠·ͨ͠

Slide 6

Slide 6 text

$ brew install Nonchalant/appicon/appicon $ appicon iTunesIcon-1024x1024.png

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

SwiftPM (Swift Package Manager) Apple͕ఏڙ͍ͯ͠Δίʔυͷڞ༗΍࠶ར༻ Λ͠΍͘͢͢ΔͨΊͷϥΠϒϥϦ؅ཧπʔϧ CocoaPods, Carthageͷྨࣅπʔϧ

Slide 9

Slide 9 text

SwiftPM (Swift Package Manager) ֎෦ϥΠϒϥϦΛར༻ͯ͠ίϚϯυϥΠϯπʔ ϧ࡞੒΋ग़དྷ·͢

Slide 10

Slide 10 text

ίϚϯυπʔϧ࡞੒ํ๏ $ swift package init --type executable

Slide 11

Slide 11 text

ੜ੒෺ . ᵓᴷᴷ .gitignore ᵓᴷᴷ Package.swift ᵓᴷᴷ Sources ᴹ ᵋᴷᴷ main.swift ᵋᴷᴷ Tests

Slide 12

Slide 12 text

Xcode্Ͱͷ։ൃ $ swift package generate-xcodeproj

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

$ swift build $ .build/debug/[Project] Hello, world!

Slide 15

Slide 15 text

Package.swift - ઃఆϑΝΠϧ - ґଘϥΠϒϥϦͷఆٛϑΝΠϧ - CocoaPodsʹ͓͚ΔPodfile - Carthageʹ͓͚ΔCartfile

Slide 16

Slide 16 text

import PackageDescription let package = Package( name: "AppIcon", targets: [ Target( name: "AppIcon", dependencies: ["AppIconCore"] ), Target(name: "AppIconCore") ], dependencies: [ .Package(url: "https://github.com/kylef/Commander", majorVersion: 0), .Package(url: "https://github.com/kareman/SwiftShell.git", "3.0.0"), .Package(url: "https://github.com/SwiftyJSON/SwiftyJSON.git", versions: Version(1, 0, 0)..

Slide 17

Slide 17 text

import PackageDescription let package = Package( name: "AppIcon", targets: [ Target( name: "AppIcon", dependencies: ["AppIconCore"] ), Target(name: "AppIconCore") ], dependencies: [ .Package(url: "https://github.com/kylef/Commander", majorVersion: 0), .Package(url: "https://github.com/kareman/SwiftShell.git", "3.0.0"), .Package(url: "https://github.com/SwiftyJSON/SwiftyJSON.git", versions: Version(1, 0, 0)..

Slide 18

Slide 18 text

ґଘϥΠϒϥϦ $PNNBOEFS ίϚϯυϥΠϯҾ਺ͷΦϓγϣϯҾ਺Λ ѻ͏ϥΠϒϥϦ 4XJGU4IFMM 4XJGUͰ4IFMM$PNNBOEΛѻ͏ ϥΠϒϥϦ 4XJGUZ+40/ 4XJGUͰ+40/Λѻ͍΍͘͢͢Δ ϥΠϒϥϦ

Slide 19

Slide 19 text

import PackageDescription let package = Package( name: "AppIcon", targets: [ Target( name: "AppIcon", dependencies: ["AppIconCore"] ), Target(name: "AppIconCore") ], dependencies: [ .Package(url: "https://github.com/kylef/Commander", majorVersion: 0), .Package(url: "https://github.com/kareman/SwiftShell.git", "3.0.0"), .Package(url: "https://github.com/SwiftyJSON/SwiftyJSON.git", versions: Version(1, 0, 0)..

Slide 20

Slide 20 text

*.appiconset AppIcon.appiconset ᵓᴷᴷContents.json ᵓᴷᴷ[email protected] ᵓᴷᴷ[email protected] ᵓᴷᴷ[email protected] ᵓᴷᴷ[email protected] ᵓᴷᴷ[email protected] ᵓᴷᴷ[email protected] ᵓᴷᴷ[email protected] ᵋᴷᴷ[email protected]

Slide 21

Slide 21 text

• Commander ‣ ૉࡐը૾Λड͚औΔ ‣ iPadΞΠίϯͳͲͷΦϓγϣϯΛѻ͏ • SwiftShell ‣ ϑΥϧμ΍ը૾ͷॻ͖ग़͠ • SwiftyJSON ‣ Contents.jsonͷॻ͖ग़͠

Slide 22

Slide 22 text

import Commander import AppIconCore let main = command(Argument("base image (1024x1024.png)", description: "The name of base image"), Option("icon-name", "AppIcon", description: "The name of generated icon name"), Option("output-path", "AppIcon", description: "The name of generated appiconset name"), Flag("ipad", description: "Whether or not to generate ipad icon")) { base, iconName, path, ipad in guard base.hasSuffix(".png") else { throw ArgumentError.missingValue(argument: "base image (1024x1024.png)") } let outputPath = "\(path).appiconset" do { try ImageExtractor.extract(input: (base, ipad), output: (iconName, outputPath)) } catch { print("Image Extraction Error is occured ") } do { try JSONExtractor.extract(input: ipad, output: (iconName, outputPath)) } catch { print("JSON Extraction Error is occured ") } print("\(outputPath) is generated ") } main.run() ը૾Λॻ͖ग़͍ͯ͠Δ $POUFOUTKTPOΛॻ͖ग़͍ͯ͠Δ ૉࡐͷύεΛड͚औ͍ͬͯΔ

Slide 23

Slide 23 text

·ͱΊ • ֶशίετ͕͍҆ • จ๏Λௐ΂Δඞཁ͕ͳ͍ • ׳Ε਌͠ΜͰ͍ΔϥΠϒϥϦΛ࢖͑Δ • ن໛͕খ͍͞ͷͰ৭ʑͱࢼͤΔ