Slide 1

Slide 1 text

Swiftʹ͓͚ΔΠϯϙʔτͱ ϦϯΫͷ࢓૊ΈΛ୳Δ

Slide 2

Slide 2 text

ࠓ೔࿩͢͜ͱ • SwiftͰओʹ࢖༻Ͱ͖ΔϥΠϒϥϦͷܗࣜ • ֤ܗࣜͷҧ͍ͱಛ௃ • Πϯϙʔτͱ͸Կ͔ • ϥΠϒϥϦΛImport͢ΔͨΊʹඞཁͳ͜ͱ • ϦϯΫͱ͸Կ͔ • ϥΠϒϥϦΛϦϯΫ͢ΔͨΊʹඞཁͳ͜ͱ

Slide 3

Slide 3 text

ϚχϡΞϧͰઃఆ XcodeͷػೳΛར༻͢Δ CocoaPods, CarthageΛར༻͢Δ ϥΠϒϥϦͷར༻ํ๏

Slide 4

Slide 4 text

ϚχϡΞϧͰઃఆ XcodeΛར༻͢Δ CocoaPods, CarthageΛར༻͢Δ ໰୊ղܾͷ೉қ౓ Hard Easy

Slide 5

Slide 5 text

ϚχϡΞϧͰઃఆ XcodeΛར༻͢Δ CocoaPods, CarthageΛར༻͢Δ ໰୊ղܾͷ೉қ౓ Hard Easy

Slide 6

Slide 6 text

ͳͥΠϯϙʔτͱϦϯΫʹ͍ͭͯ ஌Δඞཁ͕͋Δͷ͔ • ιϑτ΢ΣΞ։ൃͰ֎෦ͷϥΠϒϥϦΛར༻͢ΔͨΊ • ϥΠϒϥϦΛར༻͠ͳ͍͜ͱ͸ͳ͍ʢe.g. UIKitʣ • ϥΠϒϥϦͷར༻ऀͱͯ͠ɺར༻ʹ·ͭΘΔτϥϒϧΛղܾͰ ͖Δ • ϥΠϒϥϦͷ࡞੒ऀͱͯ͠ɺ഑෍ͷํ๏Λٕज़తʹ൑அͰ͖Δ • ϦϯΫͷઃఆ͸ར༻ऀ͕΍Δ΋ͷͳͷͰར༻ऀͷεΩϧͷ޲্ ͸ɺ࡞੒ऀɾར༻ऀͱ΋ʹϋοϐʔʹͳΔɻ

Slide 7

Slide 7 text

ͳͥΠϯϙʔτͱϦϯΫ͕ ೉͍͠ͷ͔ • ϥΠϒϥϦ͸ݟͨ໨Ͱ൑அͰ͖ͳ͍ҧ͍͕େ͖͍ • SwiftͰ͸IDE΍ίϯύΠϥʢυϥΠόʔʣʹΑΔ҉໧తͳॲཧ͕ ଟ͍ • ΠϯϙʔτͱϦϯΫ͸ಉ࣌ʹղܾ͞ΕΔΑ͏ʹΈ͑Δ͕ɺ࣮ࡍʹ ͸̎ͭʢҎ্ʣͷҟͳΔϑΣʔζͱϓϩηε • Τϥʔ͕ىͬͨ͜ͱ͖ɺද૚ͷΤϥʔϝοηʔδ͔Β͸ݪҼ͕ಡ ΈऔΕͳ͍ • ಉ͡ΤϥʔϝοηʔδͰ΋ݪҼ͸͞·͟·

Slide 8

Slide 8 text

ͳͥΠϯϙʔτͱϦϯΫ͕ ೉͍͠ͷ͔ • ൚༻తͳ஌ࣝͱXcode΍Swiftݻ༗ͷ஌ࣝͷ྆ํ͕ඞཁ • ݕࡧ͢ΔͱࣅͨΤϥʔϝοηʔδͷؔ܎ͳ͍࿩͕ͲΜͲΜ ग़ͯ͘Δ • Java΍RubyɺJavaScriptͳͲ͸VMͰಈ͘ͷͰωΠςΟϒ ίʔυͱͷϦϯΫΛΑΓ΋ચ࿅͞Εͨ࢓૊Έ͕͋Γɺͦ ͕͜τϥϒϧʹͳΔ͜ͱ͸গͳ͍

Slide 9

Slide 9 text

࣮͸Τϥʔͷύλʔϯ͸গͳ͍

Slide 10

Slide 10 text

࣮͸Τϥʔͷύλʔϯ͸গͳ͍

Slide 11

Slide 11 text

࣮͸Τϥʔͷύλʔϯ͸গͳ͍

Slide 12

Slide 12 text

ࠓ೔ͷ࿩ͰಘΒΕΔ͜ͱ • ϥΠϒϥϦͷܗࣜʹؔ͢Δ஌ࣝ • ΠϯϙʔτͱϦϯΫͷ஌ࣝ • ΠϯϙʔτͱϦϯΫʹ·ͭΘΔτϥϒϧղܾͷೳྗ جૅ Ԡ༻ • ϥΠϒϥϦ࡞੒ʹ͓͚Δ഑෍ܗଶͷٕज़൑அ • ύοέʔδϚωʔδϟͷߴ౓ͳར༻

Slide 13

Slide 13 text

ϥΠϒϥϦʹ͍ͭͯ

Slide 14

Slide 14 text

ϥΠϒϥϦͷܗࣜ ֤ܗࣜͷҧ͍ͱಛ௃

Slide 15

Slide 15 text

ϥΠϒϥϦͷܗࣜͱҧ͍ ϥΠϒϥϦͷܗࣜͱҧ͍ ΠϯϙʔτͱϦϯΫʢXcodeΛ࢖༻ͯ͠ઃఆʣ ΠϯϙʔτͱϦϯΫʢϚχϡΞϧ࡞ۀͰઃఆʣ Ϟδϡʔϧͱ͸ ϦϯΫͱ͸

Slide 16

Slide 16 text

SwiftͰओʹ࢖༻Ͱ͖Δ ϥΠϒϥϦͷܗࣜ ϑϨʔϜϫʔΫ (e.g. UIKit.framework, RxSwift.framework) μΠφϛοΫɾϥΠϒϥϦ (e.g. libsqlite3.dylib, libz.dylib) ελςΟοΫɾϥΠϒϥϦ (e.g. libssl.a, libcrypto.a)

Slide 17

Slide 17 text

SwiftͰओʹ࢖༻Ͱ͖Δ ϥΠϒϥϦͷܗࣜ μΠφϛοΫɾϑϨʔϜϫʔΫ μΠφϛοΫɾϥΠϒϥϦ ελςΟοΫɾϥΠϒϥϦ ελςΟοΫɾϑϨʔϜϫʔΫ

Slide 18

Slide 18 text

SwiftͰओʹ࢖༻Ͱ͖Δ ϥΠϒϥϦͷܗࣜ ϞδϡʔϧΛؚΉμΠφϛοΫɾϑϨʔϜϫʔΫ μΠφϛοΫɾϥΠϒϥϦ ελςΟοΫɾϥΠϒϥϦ ϞδϡʔϧΛؚ·ͳ͍μΠφϛοΫɾϑϨʔϜϫʔΫ ϞδϡʔϧΛؚΉελςΟοΫɾϑϨʔϜϫʔΫ ϞδϡʔϧΛؚ·ͳ͍ελςΟοΫɾϑϨʔϜϫʔΫ

Slide 19

Slide 19 text

SwiftͰओʹ࢖༻Ͱ͖Δ ϥΠϒϥϦͷܗࣜ ✖

Slide 20

Slide 20 text

SwiftͰओʹ࢖༻Ͱ͖Δ ϥΠϒϥϦͷܗࣜ ✖

Slide 21

Slide 21 text

SwiftͰओʹ࢖༻Ͱ͖Δ ϥΠϒϥϦͷܗࣜ ✖ ✖

Slide 22

Slide 22 text

SwiftͰओʹ࢖༻Ͱ͖Δ ϥΠϒϥϦͷܗࣜ ✖

Slide 23

Slide 23 text

ݟͨ໨ͰΘ͔Γʹ͍͘ ҧ͍ͷ૊Έ߹Θͤ ϑϨʔϜϫʔΫ ϥΠϒϥϦ μΠφϛοΫ ελςΟοΫ Swift Objective-C C Ϟδϡʔϧ༗Γ Ϟδϡʔϧແ͠ ✖ ✖ ✖ ΞʔΩςΫνϟɾ ϓϥοτϑΥʔϜ ✖

Slide 24

Slide 24 text

ݟͨ໨ͰΘ͔ʹ͍͘ͳ͍ ҧ͍ͷ૊Έ߹Θͤ ϑϨʔϜϫʔΫ ϥΠϒϥϦ μΠφϛοΫ ελςΟοΫ Swift Objective-C C Ϟδϡʔϧ༗Γ Ϟδϡʔϧແ͠ ✖ ✖ ΞʔΩςΫνϟɾ ϓϥοτϑΥʔϜ ✖ ✖

Slide 25

Slide 25 text

ݟͨ໨ͰΘ͔ʹ͍͘ͳ͍ ҧ͍ͷ૊Έ߹Θͤ ϑϨʔϜϫʔΫ ϥΠϒϥϦ μΠφϛοΫ ελςΟοΫ Swift Objective-C C Ϟδϡʔϧ༗Γ Ϟδϡʔϧແ͠ ✖ ΞʔΩςΫνϟɾ ϓϥοτϑΥʔϜ ✖ ✖ ✖

Slide 26

Slide 26 text

ݟͨ໨ͰΘ͔ʹ͍͘ͳ͍ ҧ͍ͷ૊Έ߹Θͤ ϑϨʔϜϫʔΫ ϥΠϒϥϦ μΠφϛοΫ ελςΟοΫ Swift Objective-C C Ϟδϡʔϧ༗Γ Ϟδϡʔϧແ͠ ΞʔΩςΫνϟɾ ϓϥοτϑΥʔϜ ✖ ✖ ✖ ✖

Slide 27

Slide 27 text

ݟͨ໨ͰΘ͔ʹ͍͘ͳ͍ ҧ͍ͷ૊Έ߹Θͤ ϑϨʔϜϫʔΫ ϥΠϒϥϦ μΠφϛοΫ ελςΟοΫ Swift Objective-C C Ϟδϡʔϧ༗Γ Ϟδϡʔϧແ͠ ΞʔΩςΫνϟɾ ϓϥοτϑΥʔϜ ✖ ✖ ✖ ✖

Slide 28

Slide 28 text

ݟͨ໨ͰΘ͔ʹ͍͘ͳ͍ ҧ͍ͷ૊Έ߹Θͤ ϑϨʔϜϫʔΫ ϥΠϒϥϦ μΠφϛοΫ ελςΟοΫ Swift Objective-C C Ϟδϡʔϧ༗Γ Ϟδϡʔϧແ͠ ΞʔΩςΫνϟɾ ϓϥοτϑΥʔϜ ✖ ✖ ✖ ✖

Slide 29

Slide 29 text

ϑϨʔϜϫʔΫͱ ϥΠϒϥϦͷҧ͍

Slide 30

Slide 30 text

ϑϨʔϜϫʔΫͱϥΠϒϥϦͷҧ͍ όϯυϧΛ࣋ͭ όϯυϧΛ࣋ͨͳ͍ όϯυϧΛ࣋ͨͳ͍

Slide 31

Slide 31 text

όϯυϧͱ͸ʁ Appόϯυϧ Projectόϯυϧ Settingsόϯυϧ Frameworkόϯυϧ

Slide 32

Slide 32 text

όϯυϧͱ͸ʁ

Slide 33

Slide 33 text

ελςΟοΫϦϯΫ μΠφϛοΫϦϯΫ

Slide 34

Slide 34 text

ελςΟοΫϦϯΫ μΠφϛοΫϦϯΫ Static Library (*.a) Static Framework (*.framework) Dynamic Framework (*.framework) Dynamic Library (*.dylib)

Slide 35

Slide 35 text

ελςΟοΫϦϯΫ ίϯύΠϧ Static Linking

Slide 36

Slide 36 text

μΠφϛοΫϦϯΫ ίϯύΠϧ Dynamic Linking

Slide 37

Slide 37 text

ελςΟοΫϦϯΫ μΠφϛοΫϦϯΫ ʓʓ.app ××.app

Slide 38

Slide 38 text

ελςΟοΫϥΠϒϥϦ͔ μΠφϛοΫϥΠϒϥϦ͔Λௐ΂Δ $ file Usage: file [-bcCdEhikLlNnprsvzZ0] [--apple] [--extension] [--mime-encoding] [--mime-type] [-e ] [-F ] [-f ] [-m ] [-P ] ... file -C [-m ] file [--help] file ίϚϯυ

Slide 39

Slide 39 text

ελςΟοΫϥΠϒϥϦ͔ μΠφϛοΫϥΠϒϥϦ͔Λௐ΂Δ $ file Logger.framework/Logger Logger.framework/Logger: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit x86_64 dynamically linked shared library,... [arm64:Mach-O 64-bit arm64 dynamically linked shared library,...

Slide 40

Slide 40 text

όϯυϧ༗Γ όϯυϧແ͠ ελςΟοΫϦϯΫ μΠφϛοΫϦϯΫ Static Library Static Framework Dynamic Library Dynamic Framework

Slide 41

Slide 41 text

ΠϯϙʔτͱϦϯΫ

Slide 42

Slide 42 text

ΠϯϙʔτͱϦϯΫ ϥΠϒϥϦͷܗࣜͱҧ͍ ΠϯϙʔτͱϦϯΫʢXcodeΛ࢖༻ͯ͠ઃఆʣ ΠϯϙʔτͱϦϯΫʢϚχϡΞϧ࡞ۀͰઃఆʣ Ϟδϡʔϧͱ͸ ϦϯΫͱ͸

Slide 43

Slide 43 text

Πϯϙʔτ • ֎෦ϥΠϒϥϦʢࣗ෼͕ॻ͍ͨίʔυҎ֎ʣΛࣗ෼ͷ ίʔυϕʔεͰར༻Մೳʹ͢Δߏจɾݴޠػೳ • ϥΠϒϥϦ͕ެ։͍ͯ͠ΔγϯϘϧʢΫϥεɾؔ਺ͳͲʣ Λࣗ෼ͷίʔυͰࢀরͰ͖ΔΑ͏ʹ͢Δ • ֤ϑΝΠϧʢίϯύΠϧ୯ҐʣΛίϯύΠϧ͢Δ࣌఺Ͱղ ܾ͞ΕΔ

Slide 44

Slide 44 text

ϦϯΫ • ιʔείʔυΛίϯύΠϧͯ͠ੜ੒͞ΕͨΦϒδΣΫτ ϑΝΠϧɺ͓Αͼ֎෦ϥΠϒϥϦΛ͢΂ͯ࿈݁ʢϦϯΫʣ ͯ̍ͭ͠ͷ࣮ߦܗࣜϑΝΠϧɺ͋Δ͍͸ϥΠϒϥϦΛੜ੒ ͢Δ • ϦϯΧ͕ߦ͏ • ͢΂ͯͷιʔείʔυΛίϯύΠϧͨ͠ޙʹߦΘΕΔ • ͢΂ͯͷγϯϘϧ͕ղܾ͞ΕΔ

Slide 45

Slide 45 text

࣮ࡍʹ֬ೝͯ͠ΈΑ͏

Slide 46

Slide 46 text

ϥΠϒϥϦΛར༻͢Δ Ұൠతʢ҉໧తʣͳํ๏

Slide 47

Slide 47 text

XcodeΛ࢖ͬͯ֎෦ϥΠϒϥϦΛ ར༻Մೳʹ͢Δ

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

No content

Slide 52

Slide 52 text

No content

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

Xcode͸҉໧తʹ ԿΛ͍ͯ͠Δͷ͔

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

Updated on Xcode 11

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

No content

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

Xcode͕ઃఆ͢Δ΋ͷ • FRAMEWORK_SEARCH_PATHSʹϑϨʔϜϫʔΫ͕͋Δ σΟϨΫτϦͷ਌σΟϨΫτϦΛ௥Ճ • Linked Framework and LibrariesʹϑϨʔϜϫʔΫΛ௥Ճ • Build PhaseʹCopy Files PhaseΛ௥Ճͯ͠ϑϨʔϜϫʔΫ ΛΞϓϦέʔγϣϯόϯυϧͷFrameworksσΟϨΫτϦ ʹίϐʔ͢Δ

Slide 63

Slide 63 text

FRAMEWORK_SEARCH_PATHSΛ ௐ΂Δ

Slide 64

Slide 64 text

ফͯ͠ΈΔ

Slide 65

Slide 65 text

ΠϯϙʔτͰΤϥʔ

Slide 66

Slide 66 text

Copy Files PhaseΛ ௐ΂Δ

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

No content

Slide 69

Slide 69 text

No content

Slide 70

Slide 70 text

Automatic Linking

Slide 71

Slide 71 text

No content

Slide 72

Slide 72 text

Automatic LinkingΛ ແޮʹ͢Δ

Slide 73

Slide 73 text

-disable-autolink-framework

Slide 74

Slide 74 text

No content

Slide 75

Slide 75 text

Import == Link Automatic Linking

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

No content

Slide 78

Slide 78 text

No content

Slide 79

Slide 79 text

ΠϯϙʔτͱϦϯΫ ϥΠϒϥϦͷܗࣜͱҧ͍ ΠϯϙʔτͱϦϯΫʢXcodeΛ࢖༻ͯ͠ઃఆʣ ΠϯϙʔτͱϦϯΫʢϚχϡΞϧ࡞ۀͰઃఆʣ Ϟδϡʔϧͱ͸ ϦϯΫͱ͸

Slide 80

Slide 80 text

ϑϨʔϜϫʔΫ͔Β ϑΝΠϧΛফͯ͠ΈΔ

Slide 81

Slide 81 text

ϑϨʔϜϫʔΫ͔Β ϑΝΠϧΛফͯ͠ΈΔ

Slide 82

Slide 82 text

ϑϨʔϜϫʔΫ͔Β ϑΝΠϧΛফͯ͠ΈΔ

Slide 83

Slide 83 text

ϑϨʔϜϫʔΫ͔Β ϑΝΠϧΛফͯ͠ΈΔ

Slide 84

Slide 84 text

Ϟδϡʔϧ

Slide 85

Slide 85 text

Ϟδϡʔϧͱ͸ ϥΠϒϥϦͷܗࣜͱҧ͍ ΠϯϙʔτͱϦϯΫʢXcodeΛ࢖༻ͯ͠ઃఆʣ ΠϯϙʔτͱϦϯΫʢϚχϡΞϧ࡞ۀͰઃఆʣ Ϟδϡʔϧͱ͸ ϦϯΫͱ͸

Slide 86

Slide 86 text

Ϟδϡʔϧ

Slide 87

Slide 87 text

BUILD_LIBRARY_FOR_DISTRIBUTION = YES

Slide 88

Slide 88 text

ϞδϡʔϧʢSwiftҎ֎ʣ

Slide 89

Slide 89 text

ಠࣗϞδϡʔϧΛఆٛ͢Δ

Slide 90

Slide 90 text

Module MapϑΝΠϧͷྫ

Slide 91

Slide 91 text

Bridging Headerͱͷҧ͍ • Module Map͸Bridging Headerͷ্Ґޓ׵ • Bridging Header͸ΞϓϦέʔγϣϯλʔήοτͰ͔͠࢖ ͑ͳ͍ʢϑϨʔϜϫʔΫͷ։ൃͰ͸࢖͑ͳ͍ʣ • Bridging Header͸άϩʔόϧʹ࡞༻͢ΔͷͰඞཁͳͱ͜ ͱ͚ͩͰImport͢Δͱ͍͏͜ͱ͕Ͱ͖ͳ͍ • ϓϩδΣΫτʹObjective-CͷϑΝΠϧ͕ࠞ͟Δ৔߹ʹͩ ͚࢖͏ͷ͕Α͍ʢͦͷ৔߹Ͱ΋Module Map͸࢖͑Δʣ

Slide 92

Slide 92 text

Ϟδϡʔϧͷ໾ׂ • Swift͕ϥΠϒϥϦΛΠϯϙʔτ͢Δʹ͸Ϟδϡʔϧ͕ඞ ཁʢʹΠϯϙʔτ͸Ϟδϡʔϧ͚ͩ͋Ε͹ྑ͍ʣ • PublicͳAPIͷએݴ • Objective-C/CͷϥΠϒϥϦΛΠϯϙʔτ͢Δʹ͸ɺϔο μϑΝΠϧ (.h) ΛModulemapͰϞδϡʔϧʹม׵͢Δ • Swift੡ͷϥΠϒϥϦͰ͸Ϟδϡʔϧ͸ίϯύΠϥ͕ࣗಈ తʹੜ੒͢Δ

Slide 93

Slide 93 text

Module Stability

Slide 94

Slide 94 text

https://forums.swift.org/t/plan-for-module-stability/14551 Module Stability

Slide 95

Slide 95 text

ϞδϡʔϧΛΠϯϙʔτ͢Δʹ͸ import Logger Logger Logger

Slide 96

Slide 96 text

ϞδϡʔϧΛΠϯϙʔτ͢Δʹ͸ FRAMEWORK_SEARCH_PATHS Modules import Logger Logger Logger

Slide 97

Slide 97 text

ϞδϡʔϧΛΠϯϙʔτ͢Δʹ͸ import Marketo Marketo Marketo

Slide 98

Slide 98 text

ϞδϡʔϧΛΠϯϙʔτ͢Δʹ͸ SWIFT_INCLUDE_PATHS module.modulemap import Marketo Marketo Marketo

Slide 99

Slide 99 text

ϦϯΫ

Slide 100

Slide 100 text

ϦϯΫͱ͸ ϥΠϒϥϦͷܗࣜͱҧ͍ ΠϯϙʔτͱϦϯΫʢXcodeΛ࢖༻ͯ͠ઃఆʣ ΠϯϙʔτͱϦϯΫʢϚχϡΞϧ࡞ۀͰઃఆʣ Ϟδϡʔϧͱ͸ ϦϯΫͱ͸

Slide 101

Slide 101 text

ϦϯΫͱ͸ • ίϯύΠϧͰੜ੒͞ΕͨΦϒδΣΫτϑΝΠϧͱϥΠϒϥ ϦʢΦϒδΣΫτϑΝΠϧͷू߹ʣΛ̍ͭʹ࿈݁ʢϦϯ Ϋʣ͢Δ • ίϯύΠϧͰੜ੒͞ΕͨΦϒδΣΫτϑΝΠϧͷϦϯΫ͸ ࣦഊ͠ͳ͍ͷͰɺΤϥʔ͕ى͜Δͱͨ͠Β֎෦ϥΠϒϥϦ ͱͷϦϯΫ

Slide 102

Slide 102 text

ϦϯΫͱ͸ ίϯύΠϧ Static Linking ίϯύΠϧ Dynamic Linking

Slide 103

Slide 103 text

ϥΠϒϥϦΛϦϯΫ͢Δʹ͸ʢXcodeʣ

Slide 104

Slide 104 text

ϑϨʔϜϫʔΫΛϦϯΫ͢Δʹ͸ • FRAMEWORK_SEARCH_PATHSʹϑϨʔϜϫʔΫ͕͋Δ σΟϨΫτϦͷ਌σΟϨΫτϦΛࢦఆ͢Δ • OTHER_LDFLAGSʹ-framework ͱࢦఆ͢Δ
 ʢe.g. -framework RxSwift, -framework "Alamofire"ʣ

Slide 105

Slide 105 text

ϑϨʔϜϫʔΫΛϦϯΫ͢Δʹ͸

Slide 106

Slide 106 text

ϥΠϒϥϦΛϦϯΫ͢Δʹ͸ • ϥΠϒϥϦͷ͋ΔσΟϨΫτϦͷ਌σΟϨΫτϦΛ LIBRARY_SEARCH_PATHSʹࢦఆ͢Δ • OTHER_LDFLAGSʹ-lͱࢦఆ͢Δ
 ʢe.g. -lsqlite3, -l"crypto"ʣ • ϥΠϒϥϦ໊ͷϧʔϧ
 ʢlibsqlite3.dylib => sqlite3 ɹlibssl.a => sslʣ

Slide 107

Slide 107 text

ϥΠϒϥϦΛϦϯΫ͢Δʹ͸

Slide 108

Slide 108 text

ϥΠϒϥϦΛϦϯΫ͢Δʹ͸ libssl.a FRAMEWORK_SEARCH_PATHS LIBRARY_SEARCH_PATHS OTHER_LDFLAGS = -framework "RxSwift" -l"ssl" RxSwift

Slide 109

Slide 109 text

ϥΠϒϥϦΛϦϯΫ͢Δʹ͸

Slide 110

Slide 110 text

ΞʔΩςΫνϟɾϓϥοτϑΥʔϜ͕ Ұக͠ͳ͚Ε͹ͳΒͳ͍ iOS Simulator x86_64 iOS Device arm7v iOS Device arm64 .app iOS Device arm64 ❌ ❌ ✅

Slide 111

Slide 111 text

αʔνύεΛม਺Խ͢Δ

Slide 112

Slide 112 text

CONFIGURATION_BUILD_DIR αʔνύεΛม਺Խ͢Δ CONFIGURATION_BUILD_DIR BUILD_DIR CONFIGURATION EFFECTIVE_PLATFORM_NAME .../Build/Products Debug -iphoneos FRAMEWORK_SEARCH_PATHS = "$(CONFIGURATION_BUILD_DIR)/Firebase" e.g.

Slide 113

Slide 113 text

Universal (Fat) Binary https://darkdonno.wordpress.com/2010/11/06/a-look-at-mach-o/

Slide 114

Slide 114 text

Universal Binary (lipo) $ xcrun lipo -create <...> <...> -output <...>

Slide 115

Slide 115 text

Universal Binary (lipo) $ xcrun lipo -info <...>

Slide 116

Slide 116 text

Universal Binary (Carthage)

Slide 117

Slide 117 text

XCFramework

Slide 118

Slide 118 text

μΠφϛοΫϑϨʔϜϫʔΫͷ৔߹

Slide 119

Slide 119 text

μΠφϛοΫϑϨʔϜϫʔΫͷ৔߹ @executable_path/Frameworks OTHER_LDFLAGS = -framework "RxSwift" @loader_path @rpath

Slide 120

Slide 120 text

໰୊ղܾYES/NOνϟʔτ ϥΠϒϥϦͷܗࣜͱҧ͍ ΠϯϙʔτͱϦϯΫʢXcodeΛ࢖༻ͯ͠ઃఆʣ ΠϯϙʔτͱϦϯΫʢϚχϡΞϧ࡞ۀͰઃఆʣ Ϟδϡʔϧͱ͸ ϦϯΫͱ͸

Slide 121

Slide 121 text

໰୊ղܾYES/NOνϟʔτ YESʢϦϯΫͷΤϥʔʣ Q1 ϦϯΫΤϥʔͰ͔͢ʁ NOʢΠϯϙʔτͷΤϥʔʣ

Slide 122

Slide 122 text

໰୊ղܾYES/NOνϟʔτ YESʢ*.frameworkʣ Q2 Πϯϙʔτ͠Α͏ͱ͍ͯ͠Δͷ͸ ϑϨʔϜϫʔΫͰ͔͢ʁ NOʢ*.aʣ

Slide 123

Slide 123 text

໰୊ղܾYES/NOνϟʔτ YES Q3 ϑϨʔϜϫʔΫʹϞδϡʔϧ͸ ؚ·Ε͍ͯ·͔͢ʁ NO

Slide 124

Slide 124 text

໰୊ղܾYES/NOνϟʔτ A αʔνύε͕ਖ਼͍͔֬͠ೝ͍ͯͩ͘͠͞

Slide 125

Slide 125 text

యܕతͳΤϥʔ

Slide 126

Slide 126 text

యܕతͳΤϥʔ

Slide 127

Slide 127 text

యܕతͳΤϥʔ

Slide 128

Slide 128 text

యܕతͳΤϥʔ

Slide 129

Slide 129 text

యܕతͳΠϯϙʔτΤϥʔ • αʔνύε͕ؒҧ͍ͬͯΔ • Ϟδϡʔϧ͕ͳ͍ • Module Mapʹॻ͔Ε͍ͯΔϔομ͕ࢀরͰ͖ͳ͍ • Swift 5.0·Ͱ͸όʔδϣϯͷҧ͏ίϯύΠϥͰϏϧυͨ͠Ϟ δϡʔϧΛΠϯϙʔτͰ͖ͳ͍ • ModuleMapͷ໊લ͕ϧʔϧ͔Β֎Ε͍ͯΔ
 -Xcc -fmodule-map-file="....modulemap"

Slide 130

Slide 130 text

యܕతͳϦϯΫΤϥʔ • αʔνύε͕ؒҧ͍ͬͯΔ • ର৅ͷΞʔΩςΫνϟɾϑϨʔϜϫʔΫͷόΠφϦ͕Ϗϧυ͞Εͯͳ ͍ • dyld: image not found • μΠφϛοΫϑϨʔϜϫʔΫ͕ίϐʔ͞Εͯͳ͍ • େจࣈখจࣈͷҧ͍ • Swift 4.2·Ͱ͸όʔδϣϯͷҧ͏ίϯύΠϥͰϏϧυͨ͠όΠφϦΛ ϦϯΫͰ͖ͳ͍

Slide 131

Slide 131 text

ΞʔΩςΫνϟ͕ݟ͔ͭΒͳ͍ • xcrun lipo -info ... • CocoaPodsΛ࢖͍ͬͯΔͳΒ͢΂ͯͷΞʔΩςΫνϟ͕ Ϗϧυ͞Ε͍ͯΔ͔ • Ϗϧυߏ੒ͷ໰୊

Slide 132

Slide 132 text

Ԡ༻ฤ

Slide 133

Slide 133 text

CϥΠϒϥϦʹґଘʢϦϯΫʣ͢Δ ϑϨʔϜϫʔΫΛ࡞੒͢Δ 1. ར༻ऀ͕ࣗ෼ͰCϥΠϒϥϦͷϦϯΫΛઃఆ͢Δ 2. ར༻ऀ͔Β͸CϥΠϒϥϦͷଘࡏ͸Ӆ͍ͨ͠

Slide 134

Slide 134 text

CocoaPodsΛϫʔΫεϖʔεʹ ౷߹ͤͣʹ࢖༻͢Δ • CocoaPods͕αʔνύε΍ϦϯΧϑϥάࣗಈઃఆ͢Δػ ೳΛ࢖Θͣʹɺࣗ෼Ͱ֤ϥΠϒϥϦΛϏϧυ͠ϦϯΫͷ ઃఆΛ͢Δɻ
 ϫʔΫεϖʔεʹCocoaPodsͷઃఆ͕ࠞ͟Βͣʹॊೈ͔ ͭγϯϓϧʹར༻Ͱ͖Δ͜ͱ͕ϝϦοτɻ

Slide 135

Slide 135 text

CarthageͰϏϧυͤͣʹ ϓϩδΣΫτࢀরͰ؅ཧ͢Δ • Carhage͸ϢχόʔαϧόΠφϦΛࣗಈతʹϏϧυͯ͘͠ ΕΔ͕ɺσόοά͠ʹ͍͘ͳͲσϝϦοτ΋͋ΔͷͰɺϏ ϧυͤͣʹϓϩδΣΫτͷνΣοΫΞ΢τ͚ͩͯ͠ར༻͢ Δɻ

Slide 136

Slide 136 text

ෳ਺ͷμΠφϛοΫϑϨʔϜϫʔΫΛ ̍ͭͷϑϨʔϜϫʔΫʹ౷߹͢Δ • μΠφϛοΫϑϨʔϜϫʔΫ͕૿͑ͯ͘Δͱىಈ࣌ؒʹӨ ڹΛ༩͑Δʢdyld2ͷ৔߹ʣ
 ͦͷͨΊ֤ϑϨʔϜϫʔΫΛελςΟοΫϦϯΫͯ͠ɺ̍ ͭͷେ͖ͳμΠφϛοΫϑϨʔϜϫʔΫʹ͢Δ • Ϟδϡʔϧ͸ݩͷ෼͔Εͨঢ়ଶͰࢀর͢ΔͱศརʢΠϯ ϙʔτ͸ίϯύΠϧ͚࣌ͩͳͷͰϑϨʔϜϫʔΫͷߏ଄ͱ ঢ়ଶ͕ҟͳͬͯ΋໰୊ͳ͍ʣ

Slide 137

Slide 137 text

Recap • Πϯϙʔτ͸ϞδϡʔϧΛࣗ෼ͷίʔυϕʔεͰར༻Մೳ ʹ͢Δ • ϦϯΫ͸͢΂ͯͷϑΝΠϧͷίϯύΠϧޙɺΦϒδΣΫτ ϑΝΠϧͱϥΠϒϥϦΛ݁߹͢Δ • αʔνύεͱίϯύΠϥϑϥάͰίϯτϩʔϧ • ίϯύΠϥͱϦϯΧ͸ίϯϐϡʔλαΠΤϯεͷͲਅΜத • ௿ϨΠϠʔΛ୳ࡧָ͍ͯ͘͠͠͞

Slide 138

Slide 138 text

Reference • Creation of pure Swift module
 https://railsware.com/blog/creation-of-pure-swift-module/ • Mach-O Universal / Fat Binaries – Symbol Crash
 https://www.symbolcrash.com/2019/02/26/mach-o-universal-fat-binaries/ • Parsing Mach-O files - Low Level Bits
 https://lowlevelbits.org/parsing-mach-o-files/ • Swift Imports
 https://thoughtbot.com/blog/swift-imports

Slide 139

Slide 139 text

Reference • Static and Dynamic Libraries
 https://pewpewthespells.com/blog/static_and_dynamic_libraries.html • Framework vs Library (Cocoa, iOS) – Knowledge Stack
 http://www.knowstack.com/framework-vs-library-cocoa-ios/ • Static linking vs dyld3
 https://allegro.tech/2018/05/Static-linking-vs-dyld3.html • Understanding Xcode Build System
 https://www.vadimbulavin.com/xcode-build-system/

Slide 140

Slide 140 text

Reference • Static and Dynamic Libraries and Frameworks in iOS
 https://www.vadimbulavin.com/static-dynamic-frameworks-and-libraries/ • Static Library, Dynamic Library and Framework in iOS
 https://medium.com/@arkilis/static-library-dynamic-library-and-framework-in-ios-df137f29a3e9 • Dynamic Versus Static Framework in iOS - CA for Developers
 https://www.ca.com/en/blog-developers/dynamic-versus-static-framework-in-ios.html • Overview: iOS Static and Dynamic Frameworks and Libraries
 https://www.runtastic.com/blog/en/frameworks-ios/

Slide 141

Slide 141 text

Reference • Undocumented Mac OS Xɿୈ12ճɹUniversal Binaryʲલฤʳ (1/5)
 https://www.itmedia.co.jp/enterprise/articles/0711/30/news014.html • Undocumented Mac OS Xɿୈ13ճɹUniversal Binaryʲޙฤʳ (1/4)
 https://www.itmedia.co.jp/enterprise/articles/0712/27/news012.html