Slide 1

Slide 1 text

DocC Documentation Archive Λ ΞϓϦ։ൃͰ׆༻ͯ͠ΈΑ͏ 2022/09/28 After Party iOSDC Japan 2022 @aomathwift

Slide 2

Slide 2 text

ࣗݾ঺հ Aoi Okawa (@aomathwift) Cookpad Inc. iOS Developer Cookpad Mart

Slide 3

Slide 3 text

͓͜ͱΘΓ • ͜Ε͸ΞϓϦͷυΩϡϝϯτΛ DocC ʹஔ͖׵͑ͨͱ͍͏ࣄྫͷ࿩Ͱ ͸͋Γ·ͤΜ • ΞϓϦέʔγϣϯλʔήοτͰ DocC Λॱ౰ʹѻ͏ํ๏ʹ͍ͭͯ͸ৄ ͘͠৮Ε·ͤΜ • ͋͘·ͰݕূͱΞΠσΞͷ࿩ͱͯ͠ฉ͍͍ͯͩ͘͞

Slide 4

Slide 4 text

Swift-DocC ͰͷυΩϡϝϯτ࡞੒

Slide 5

Slide 5 text

Swift-DocC ͱ͸ • Apple ७ਖ਼ͷυΩϡϝϯτ࡞੒πʔϧ • Xcode 13 Ҏ߱ʹ౷߹ • OSS ͱͯ͠΋ެ։͞Ε͍ͯΔ

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

Swift-DocC ͷΞοϓσʔτ • Xcode 13.3 ͔ΒΞϓϦέʔγϣϯ޲͚ͷϏϧυΛαϙʔτ • Github Pages ʹ؆୯ʹϗεςΟϯάͰ͖Δػೳ → ΞϓϦυΩϡϝϯτͷ DocC ԽΛקΊΔػӡʁ

Slide 8

Slide 8 text

ΞϓϦʹඞཁͳυΩϡϝϯτ • ϓϩδΣΫτͷߏ੒΍ΞʔΩςΫνϟ • CI / CD ʹ͍ͭͯ • ։ൃϑϩʔ΍։ൃ؀ڥͷηοτΞοϓ • Utility Ϋϥεͷϝιου΍ϓϩύςΟͷઆ໌

Slide 9

Slide 9 text

ΞϓϦʹඞཁͳυΩϡϝϯτ • ϓϩδΣΫτͷߏ੒΍ΞʔΩςΫνϟ • CI / CD ʹ͍ͭͯ • ։ൃϑϩʔ΍։ൃ؀ڥͷηοτΞοϓ • Utility Ϋϥεͷϝιου΍ϓϩύςΟͷઆ໌ → Documentation Έ͍ͨͳσΟϨΫτϦ഑Լʹஔ͍͍ͯΔ

Slide 10

Slide 10 text

ΞϓϦʹඞཁͳυΩϡϝϯτ • ϓϩδΣΫτͷߏ੒΍ΞʔΩςΫνϟ • CI / CD ʹ͍ͭͯ • ։ൃϑϩʔ΍։ൃ؀ڥͷηοτΞοϓ • Utility Ϋϥεͷϝιου΍ϓϩύςΟͷઆ໌ → README.md ΍ CONTRIBUTING.md

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

ΞϓϦʹඞཁͳυΩϡϝϯτ • ϓϩδΣΫτͷߏ੒΍ΞʔΩςΫνϟ • CI / CD ʹ͍ͭͯ • ։ൃϑϩʔ΍։ൃ؀ڥͷηοτΞοϓ • Utility Ϋϥεͷϝιου΍ϓϩύςΟͷઆ໌ → ίʔυίϝϯτ = DocC ͷه๏Λར༻

Slide 13

Slide 13 text

ΞϓϦʹඞཁͳυΩϡϝϯτ • ϓϩδΣΫτͷߏ੒΍ΞʔΩςΫνϟ • CI / CD ʹ͍ͭͯ • ։ൃϑϩʔ΍։ൃ؀ڥͷηοτΞοϓ • Utility Ϋϥεͷϝιου΍ϓϩύςΟͷઆ໌ → Documentation Catalog Λ࢖͏

Slide 14

Slide 14 text

Documentation Catalog •Markdownهࣄ΍֦ுϑΝΠϧΛ ؚΊΔ͜ͱͰಛఆͷAPIͷઆ໌Ҏ֎ ͷ෦෼ͷυΩϡϝϯτΛิ׬ •ެࣜυΩϡϝϯτͷ Overview ͷ ϖʔδ౳͕֘౰

Slide 15

Slide 15 text

͜͏͢Δͱ DocC ԽͰ͖Δ • طଘͷ Markdown ϑΝΠϧΛ Documentation Catalog ʹೖΕࠐΉ • ಛఆͷϝιου΍Ϋϥεͷઆ໌͸ DocC ίϝϯτΛॻ͖ࠐΉ

Slide 16

Slide 16 text

طଘͷυΩϡϝϯτͰݴ͏ͯࠔͬͯͳ͍ Ͱ΋ DocC ͸ͪΐͬͱ৮ͬͯΈ͍ͨͳ͊🥺

Slide 17

Slide 17 text

Documentation Archive ͱ͍͏΋ͷΛ༻͍ͯ ผͷܗͰ Swift-DocC Λ׆༻ͯ͠Έ·͠ΐ͏

Slide 18

Slide 18 text

Agenda • DocC Documentation Archive ͱ͸ • Documentation Archive ͷߏ଄ • Documentation Archive ͷ׆༻

Slide 19

Slide 19 text

Documentation Archive ͍ͭͯ

Slide 20

Slide 20 text

Documentation Archive • *.doccarchive ֦ுࢠΛ࣋ͭυΩϡϝϯτͷຊମσΟϨΫτϦ • Xcode Ͱ։͘ͱ DocC υΩϡϝϯτͱͯ͠ϨϯμϦϯά͞ΕΔ

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

Documentation Archive ͷϏϧυ • Xcode ͷ GUI ͔Β࣮ߦ • Xcode ෇ଐͷ doccbuild ίϚϯυͰ࣮ߦ

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Documentation Archive ͷϏϧυ(CLI) $ xcodebuild -workspace CookpadMart.xcworkspace -scheme "CookpadMart" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13 Pro,OS=16.0' docbuild -derivedDataPath .build

Slide 25

Slide 25 text

Documentation Archive ͷߏ଄

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

*.doccarchive • υΩϡϝϯτΛϨϯμϦϯά͢Δͷʹඞཁͳ৘ใͷू·Γ • Xcode13 ·Ͱ͸͜ͷσΟϨΫτϦΛϏϧυࡁΈυΩϡϝϯτ͔Β௚ ઀ Export Ͱ͖ͨ ※ Xcode14 ͔Β͸ *.doccarchive/documentation ҎԼͷ HTML ϑΝΠ ϧୡ͔͠ Export Ͱ͖ͳ͍

Slide 28

Slide 28 text

*.doccarhive/data • ύʔε͞Εͨίϝϯτ౳͕ϝιου΍Ϋϥε͝ͱʹߏ଄Խ͞Εͨ΋ͷ • υΩϡϝϯτͷݟͨ໨Ͳ͓Γͷ৘ใΛ json ͷܗͰ΋ͭ • {Target Name}.json ͕ϧʔτʹ͍Δ

Slide 29

Slide 29 text

{ "variants": [ ... ], "schemaVersion": { ... }, "sections": [], "identifier": { ... }, "topicSections": [ ... ], "kind": "symbol", "metadata": { ... }, "hierarchy": { ... }, "references": { ... } }

Slide 30

Slide 30 text

{Target Name}.json • τοϓϖʔδ৘ใʹ͋ͨΔ΋ͷ • topicSections • Classes, Protocols, Structures, Variables, … • references • ֤Ϋϥε౳ͷυΩϡϝϯτͷID΍ද໊ࣔ

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

"topicSections": [ { "title": "Classes", "identifiers": [ “doc:\/\/bunle-id\/documentation\/CookpadMartEC\/MartActivityLogger" ... ] }, { "title": "Protocols", "identifiers": [ ... ] }, { "title": "Structures", "identifiers": [ ... ] }, { "title": "Variables", "identifiers": [ ... ] }, { "title": "Functions", "identifiers": [ ... }, { "title": "Operators", "identifiers": [ … ] }, { "title": "Type Aliases", "identifiers": [ ... ] }, { "title": "Enumerations", "identifiers": [ ... ] } ] { "variants": [ ... ], "schemaVersion": { ... }, "sections": [], "identifier": { ... }, "topicSections": [ ... ], "kind": "symbol", "metadata": { ... }, "hierarchy": { ... }, "references": { ... } }

Slide 33

Slide 33 text

"references": { "doc://bundle-id/documentation/CookpadMart/ActivityLogger": { "role": "symbol", "title": "ActivityLogger", "fragments": [ { "kind": "keyword", "text": "protocol" }, { "kind": "text", "text": " " }, { "kind": "identifier", "text": "ActivityLogger" } ], "identifier": “doc:\/\/bundle-id\/documentation\/ CookpadMart\/ActivityLogger", "kind": "symbol", "type": "topic", "url": “\/documentation\/cookpadmartec\/activitylogger" }, ... } { "variants": [ ... ], "schemaVersion": { ... }, "sections": [], "identifier": { ... }, "topicSections": [ ... ], "kind": "symbol", "metadata": { ... }, "hierarchy": { ... }, "references": { ... } }

Slide 34

Slide 34 text

֤ class ͝ͱͷϑΝΠϧɾσΟϨΫτϦ • جຊతʹͦͷϖʔδͷυΩϡϝϯτʹฒ΂ΒΕΔηΫγϣϯͷ৘ใΛ ֤ηΫγϣϯ໊ͷΩʔʹ΋ͨͤΒΕ͍ͯΔ • σΟϨΫτϦҎԼ͸ϝιουɾม਺͝ͱʹಉ༷ͷηΫγϣϯσʔλΛ ΋ͬͨ json ϑΝΠϧ͕٧Ίࠐ·Ε͍ͯΔ

Slide 35

Slide 35 text

{ "primaryContentSections": [ ... ], "schemaVersion": { ... }, "sections": [], "variants": [ ... ], "relationshipsSections": [ ... ], "identifier": { ... }, "topicSections": [ ... ], "kind": "symbol", "metadata": { ... }, "hierarchy": { ... }, "references": { ... } }

Slide 36

Slide 36 text

֤ class ౳ͷϑΝΠϧ • topicSections • Initializers, Instance Properties, Instsnce Methods… ͳͲ • primaryContentSections • declaration ͳͲ • relationshipsSections • inheritFrom, conformTo, conformingType

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

"primaryContentSections": [ { "kind": "declarations", "declarations": [ { "tokens": [ { "kind": "keyword", "text": "protocol" }, { "kind": "text", "text": " " }, { "kind": "identifier", "text": "ActivityLogger" } ], "languages": [ "swift" ], "platforms": [ "iOS" ] } ] } ] { "primaryContentSections": [ ... ], "schemaVersion": { ... }, "sections": [], "variants": [ ... ], "relationshipsSections": [ ... ], "identifier": { ... }, "topicSections": [ ... ], "kind": "symbol", "metadata": { ... }, "hierarchy": { ... }, "references": { ... } }

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

"topicSections": [ { "title": "Structures", "identifiers": [ ... ] }, { "title": "Initializers", "identifiers": [ ... ] }, { "title": "Instance Properties", "identifiers": [ ... ] }, { "title": "Instance Methods", "identifiers": [ ... ] }, { "title": "Type Aliases", "identifiers": [ ... ] }, { "title": "Type Properties", "identifiers": [ ... ] }, { "title": "Type Methods", "identifiers": [ ... ] }, { "title": "Default Implementations", "identifiers": [ ... ], "generated": true } ] { "primaryContentSections": [ ... ], "schemaVersion": { ... }, "sections": [], "variants": [ ... ], "relationshipsSections": [ ... ], "identifier": { ... }, "topicSections": [ ... ], "kind": "symbol", "metadata": { ... }, "hierarchy": { ... }, "references": { ... } }

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

"relationshipsSections": [ { "identifiers": [ "doc:\/\/bundle-id\/documentation\/CookpadMart\/ EmptyActivityLogger", "doc:\/\/bundle-id\/documentation\/CookpadMart\/ MartActivityLogger" ], "kind": "relationships", "title": "Conforming Types", "type": "conformingTypes" } ] { "primaryContentSections": [ ... ], "schemaVersion": { ... }, "sections": [], "variants": [ ... ], "relationshipsSections": [ ... ], "identifier": { ... }, "topicSections": [ ... ], "kind": "symbol", "metadata": { ... }, "hierarchy": { ... }, "references": { ... } }

Slide 43

Slide 43 text

relationshipsSections • ґଘؔ܎ʹ͋ΔཁૉΛ ID ͰϦετΞοϓ • ࣗ਎͕ܧঝ͍ͯ͠Δɾ͞Ε͍ͯΔ class • ࣗ਎͕४ڌ͍ͯ͠Δɾ͞Ε͍ͯΔ protocol • ผϞδϡʔϧͷ΋ͷ΍ඪ४ϥΠϒϥϦͷ΋ͷ΋ࢀরͰ͖Δ → 💡 ґଘؔ܎ͷՄࢹԽʹ࢖͑ͦ͏

Slide 44

Slide 44 text

ґଘؔ܎͕ݟ͑ΔͱԿ͕خ͍͔͠ • ϦϑΝΫλϦϯάͷͱ͖ʹͲ͜ʹӨڹ͕ग़Δ͔Λ೺ѲͰ͖Δ • ৽ϝϯόʔʹ৘ใڞ༗͢Δͱ͖ʹίʔυΛ௥͏ΑΓ؆୯

Slide 45

Slide 45 text

Documentation Archive ͷ׆༻ ґଘؔ܎ΛՄࢹԽͯ͠ΈΔ

Slide 46

Slide 46 text

ํ਑ • ు͖ग़͞Εͨ *.doccarchive ʹରͯ͠ҎԼΛ࣮ߦ͢Δ • ֤ json ͷ relationshipsSections Ωʔͷ஋Λࢀর͢Δ • identi fi ers Ωʔͷ஋͔Βґଘؔ܎ʹ͋ΔཁૉΛऔಘ͢Δ • type Ωʔͷ஋ΛΈ্ͯهཁૉͱ֘౰ͷཁૉͱͷؔ܎Λൈ͖ग़͢

Slide 47

Slide 47 text

࣮૷ • ҎԼͷ Ruby εΫϦϓτΛϓϩδΣΫτ಺Ͱ࣮ߦ͍ͯ͠·͢ • https://github.com/aomathwift/dependencies_generator

Slide 48

Slide 48 text

ҰཡΛςΩετͷ··ग़ྗʢˢ͸ Markdown Ͱগ͠੔ܗʣ

Slide 49

Slide 49 text

ಛఆͷཁૉʹର͢ΔґଘΛ PlantUML Ͱग़ྗ

Slide 50

Slide 50 text

࣮ࡍʹϓϩδΣΫτ಺Ͱ׆༻͢Δʹ͸ • ੒Ռ෺ΛϦϙδτϦ಺ʹ഑ஔ͠ɺࣗಈςετͰఆظతʹߋ৽͞ΕΔঢ় ଶʹ͢Δ • ੒Ռ෺ΛఆظతʹνʔϜͰோΊΔ࣌ؒΛ࡞Δ

Slide 51

Slide 51 text

ͦͷଞͷσʔλ׆༻ߏ૝ • UIViewController Λܧঝ͍ͯ͠ΔΫϥεΛϦετΞοϓͯ͠ΞϓϦͷ ը໘ϦετΛ࡞Δ • conformingType ͷແ͍ protocol ͱ͔Λࣗಈݕ஌ͯ͠࡟আΛקΊΔΞ ϥʔτΛग़͢

Slide 52

Slide 52 text

·ͱΊ • Documentation Archive ͸ DocC υΩϡϝϯτΛ࡞Δͷʹඞཁͳཁૉ ͕٧Ίࠐ·Ε͍ͯͯ৘ใΛ༷ʑͳܗͰ׆༻Ͱ͖Δ • ΞϓϦͰͷ Swift-DocC ׆༻ͷՄೳੑ͸޿͕͍ͬͯΔ🚀