Author and share great documentation for your Swift packages and frameworks.

Posts under DocC tag

69 Posts

Post

Replies

Boosts

Views

Activity

DocC doesn't handled named subscript parameters correctly
Xcode 14.0.1 running on macOS Monterey 12.6. I have a class MeetingDirectory that defines two subscript functions: public subscript(_ date: String) -> ValueOrMessage<Meeting> { ... } public subscript(_ date: String, visit: CaseID) -> ValueOrMessage<Meeting> { ... } In my DocC extension file for this class, I want to generate links to the documentation for both subscripts. Problem 1: I type two backticks and Xcode offers autocompletions for all the class's public functions, including two subscript functions; but the subscript functions are each presented in the autocomplete list as just subscript with no additional information — there is no way to differentiate them. Problem 2: By trial-and-error, I find that one subscript expands into subscript(_:) and the other one expands into subscript(_:visit:), as I would have expected. So my topics list looks like: ### Getting a Specific Meeting - ``subscript(_:)`` - ``subscript(_:visit:)`` But when I compile the documentation, the subscript(_:visit:) line gets this warning: “Topic reference 'subscript(_%3Avisit%3A)' couldn't be resolved. No local documentation matches this reference.” and subscript(_:visit:) doesn't show up in the “Getting a Specific Meeting” topic section. Instead, it shows up in the default “Subscripts” section, with the signature subscript(String, CaseID) -> ValueOrMessage<Meeting> and if you click on the link, the title on the function documentation page has the signature subscript(_:_:) (although the “Declaration” and “Parameters” sections on the function documentation page are correct). Problem 3: So I tried writing the symbol reference as subscript(_:_:) instead. Now the documentation compiles without errors, and both subscript functions show up under “Getting a Specific Meeting”, but, as you might expect, it still shows up with the (_:_:) signature.
2
0
1.4k
Oct ’22
DocC home page or redirect to /documentation/<target-name>
I just set up my GitHub Actions pipeline to publish the static content generated by DocC to GitHub Pages. Unfortunately, the way DocC works means I must go to my GitHub Pages URL e.g. (<username>.github.io/<repo-name>) and then append a /documentation/<target-name> path to get where I want. It's frustrating that the buttons GitHub's UI provides all link to <username>.github.io/<repo-name> and I have to keep appending DocC's path to view the documentation. Is there a way to tell DocC there's just one target, and to show that at / instead of /documentation/<target-name>? Or could the DocC team perhaps add a default generated home page with links to the various targets' documentation? Then it's not a blank page when navigating to the base GitHub Pages URL. Thanks!
2
0
2.2k
Sep ’22
Is it possible to present the interactive tutorial inside the app?
I have an app which is a little complicated to figure out details without a help document. I don't want to host the help document only on a web server for users who might not prefer to leave the app and go through the tutorial on a web page. So my question is: Is it possible to make use of DocC tutorial and present the tutorial to my users in the app without leaving the app? Is not, the only solution would be to provide a link for my users to open the web page in Safari I guess. My second question is: Is it possible to host DocC tutorial on an Amazon S3 bucket?
1
0
906
Aug ’22
How to contribute to modify Developer Documentation?
Is there a way to contribute to Developer Documentation about the Core Data framework? I've found the wrong part in the developer document. I'd like to correct this. I wanted to modify it by sending a pull request from github, but I couldn't find where I could do it in apple's github. Can you give me some advice on what to do? Thank you in advance for your help! :)
1
0
1.1k
Aug ’22
Build Documentation in App for binary frameworks distributed over SPM
Given is an app project with two SPM dependencies: one to a source code repro and one to a repro containing in XCFramework. Using "Build Documentation" in Xcode generates the documentation for the app and source framework but not for the XCFramework. Wonder, why the documentation is not generated from the symbol graph of the binary Tried to create a .doccarchive with the framework using "Build Documentation during 'Build'" build setting, but: .doccarchive is not copied when creating a XCFramework after adding .doccarchive to XCFramework, it will not be resolved and downloaded via SPM Is there any way to distribute the documentation of my binary framework over SPM to be displayed in the Documentsbrowser using the "Build Documentation" command?
1
2
1.4k
Aug ’22
DocC: How to write content from another file in documentation
I want to lint my documentation without having to run vale checks throughout the code. So I created "testing-docs.md", added content like "This is a testing document for linting checks." Now in my class, I have added my documentation in comment like stated by Apple. /// <testing-docs.md> /// -Parameters: /// - token: conn123 /// - payload: nothing for now /// - fromViewController: <#fromViewController description#> /// - completion: <#completion description#> Is there a way that instead of <testing-docs.md>, I get the file's content displayed "This is a testing document for linting checks." I don't want to do it manually because I want to lint content separately. I have multiple md files.
1
0
1.6k
Jul ’22
Error while generating a DocC based documentation for a Swift Package
I want to generate a DocC documentation for an internal Swift Package with the help of SwiftDocC plugin using the following command: The internal framework uses realm-core and realm-cocoa. $ swift package --disable-sandbox preview-documentation --product InternalFramework Actual Results If I build the DocC files via Xcode the build documentation is generated. But if I use the above command on the terminal to generate. There is an error shown on the terminal and the framework fails to build the documentation. The following is the error shown on the terminal Computing version for https://github.com/realm/realm-cocoa.git Computed https://github.com/realm/realm-cocoa.git at 10.28.1 (0.64s) Computing version for https://github.com/realm/realm-core Computed https://github.com/realm/realm-core at 12.1.0 (0.36s) error: Couldn’t update repository submodules: fatal: could not get a repository handle for submodule 'tools/vcpkg/ports' I do not understand whether it is a DocC based issue or a realm issue. Steps & Code to Reproduce Running the following command causes the error: $ swift package --disable-sandbox preview-documentation --product InternalFramework I am not able to understand the root cause of the error.
1
0
1.5k
Jul ’22
Does Swift DocC Plugin support iOS frameworks?
I encountered an issue that I could use the SPM DocC plugin to produce documentation. Will the new version of the Xcode 14 and SPM DocC plugin allow to build directly the documentation using the plugin for the frameworks that e.g. use the UIKit frameworks? When I try to run the plugin and in addition pass sdk and target parameters swift package -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios15.3-simulator" --allow-writing-to-directory ./docs generate-documentation --target UIEnvironment Building for debugging... Build complete! (0.09s) Generating documentation for 'UIEnvironment'... Building for debugging... Build complete! (0.07s) error: 'UIEnvironment' does not contain any documentable symbols or a DocC catalog and will not produce documentation More about it on the Swift Forums: https://forums.swift.org/t/swift-docc-plugin-for-swiftpm/54725/30 Currently, I resolve to directly use Swift DocC rm -rf .build; mkdir -p .build/symbol-graphs \ && swift build --target UIEnvironment \ -Xswiftc "-sdk" \ -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" \ -Xswiftc "-target" \ -Xswiftc "arm64-apple-ios15.4-simulator" \-Xswiftc -emit-symbol-graph \ -Xswiftc -emit-symbol-graph-dir -Xswiftc .build/symbol-graphs; mkdir -p .build/swift-docc-symbol-graphs \ && mv .build/symbol-graphs/UIEnvironment* .build/swift-docc-symbol-graphs; export DOCC_HTML_DIR="$(dirname $(xcrun --find docc))/../share/docc/render"; rm -rf docs-out; mkdir -p docs-out/main \ && ../swift-docc/.build/debug/docc convert Sources/UIEnvironment/Documentation.docc \ --fallback-display-name UIEnvironment \ --fallback-bundle-identifier com.plum.UIEnvironment \ --fallback-bundle-version 1.0.0 \ --additional-symbol-graph-dir .build/swift-docc-symbol-graphs \ --transform-for-static-hosting \ --hosting-base-path /UIEnvironment/main \ --output-path docs-out/main; cp -R docs-out/main main another solution is to use xcodebuild docbuild Is it an expected shortcoming that cannot be resolved because of the multiplatform nature of SPM or just a temporary limitation?
1
0
2.2k
Jun ’22
DocC for something else than Swift.
Hello My projects are all in C and Objective-C and have a 0% chance to ever use Swift (portability is super important for me). However I love to write code in Xcode and the new DocC feature looks like something you definitively want to support. Now I set up a test project and it seems to be that DocC does only work in Swift. If you annotate plain-C functions it produces zero output. Not even a workspace documentation entry pops up. Given Apple has plenty of documentation pointing to Unix C functions and Apple libraries you can call in C, I find it rather strange that this doesn't work. Is this intentionally or am I missing a few additional things to make it work for C?
2
0
1.2k
Jun ’22
Can DocC Generate Documentation for Extensions?
Is there a way to force the documentation compiler to generate documentation for extensions to types outside a package/framework? This is incredibly important, as some packages and frameworks extend types that are part of the Swift Foundation (e.g., extensions to primitive types and collection) and SwiftUI (e.g., view modifiers and environment values).
5
0
2.7k
Apr ’22
Static Hosting Support using DocC
I'm able to create my documentation via Xcode-> Product -> Build Documentation and that creates MY_PROJ.docarchive. I can also create .docarchive using xcodebuild command Now I'm trying to convert/export my .docarchive to host it in static space so that I can host it on Github pages. I'm using https://github.com/apple/swift-docc to convert my docarchive using the following command, swift run docc process-archive transform-for-static-hosting <path/to/docarchive> --output-path <destination_path> I can see the files exported in output-path which I believe is the files that I need to deploy in static hosting space. But when I host the same files in my local server or Github pages, they are still blank. Not sure what's wrong here.
3
0
4.1k
Apr ’22
Document extensions
Hi guys ;-) I've been implementing a small package that mainly consist of extensions. I added my documentation as usual (visible with the quick help/doc shortcut) I wanted to use DocC to generate a more in depth documentation, but it seems that extensions are not supported. Right out of the box (w/o any doc catalog), if I generate the documentation, it's empty. I can add a Doc Catalog, but I can't make any link to my files since there are no classes per se. MyPackage. gives nothing :-/ Is there a way to achieve that ? Thx.
5
0
1.2k
Feb ’22
How to host multiple docarchives on a single http server?
I have a few different projects and a ton of tutorials I want to host on the same http server... is this possible? I watched the Host and automate your DocC documentation session, but it seemed to only work with those rules for one docarchive. I know someone filed feedback for prefixes (https://developer.apple.com/forums/thread/682276)... is this possible already? Thanks.
3
0
3.3k
Feb ’22
Can DocC be used with C++?
Someone asked this question before, but the answer just talked about Objective-C, and now that post is locked.
Replies
1
Boosts
0
Views
1.8k
Activity
Dec ’22
DocC doesn't handled named subscript parameters correctly
Xcode 14.0.1 running on macOS Monterey 12.6. I have a class MeetingDirectory that defines two subscript functions: public subscript(_ date: String) -> ValueOrMessage<Meeting> { ... } public subscript(_ date: String, visit: CaseID) -> ValueOrMessage<Meeting> { ... } In my DocC extension file for this class, I want to generate links to the documentation for both subscripts. Problem 1: I type two backticks and Xcode offers autocompletions for all the class's public functions, including two subscript functions; but the subscript functions are each presented in the autocomplete list as just subscript with no additional information — there is no way to differentiate them. Problem 2: By trial-and-error, I find that one subscript expands into subscript(_:) and the other one expands into subscript(_:visit:), as I would have expected. So my topics list looks like: ### Getting a Specific Meeting - ``subscript(_:)`` - ``subscript(_:visit:)`` But when I compile the documentation, the subscript(_:visit:) line gets this warning: “Topic reference 'subscript(_%3Avisit%3A)' couldn't be resolved. No local documentation matches this reference.” and subscript(_:visit:) doesn't show up in the “Getting a Specific Meeting” topic section. Instead, it shows up in the default “Subscripts” section, with the signature subscript(String, CaseID) -> ValueOrMessage<Meeting> and if you click on the link, the title on the function documentation page has the signature subscript(_:_:) (although the “Declaration” and “Parameters” sections on the function documentation page are correct). Problem 3: So I tried writing the symbol reference as subscript(_:_:) instead. Now the documentation compiles without errors, and both subscript functions show up under “Getting a Specific Meeting”, but, as you might expect, it still shows up with the (_:_:) signature.
Replies
2
Boosts
0
Views
1.4k
Activity
Oct ’22
DocC home page or redirect to /documentation/<target-name>
I just set up my GitHub Actions pipeline to publish the static content generated by DocC to GitHub Pages. Unfortunately, the way DocC works means I must go to my GitHub Pages URL e.g. (<username>.github.io/<repo-name>) and then append a /documentation/<target-name> path to get where I want. It's frustrating that the buttons GitHub's UI provides all link to <username>.github.io/<repo-name> and I have to keep appending DocC's path to view the documentation. Is there a way to tell DocC there's just one target, and to show that at / instead of /documentation/<target-name>? Or could the DocC team perhaps add a default generated home page with links to the various targets' documentation? Then it's not a blank page when navigating to the base GitHub Pages URL. Thanks!
Replies
2
Boosts
0
Views
2.2k
Activity
Sep ’22
Is it possible to present the interactive tutorial inside the app?
I have an app which is a little complicated to figure out details without a help document. I don't want to host the help document only on a web server for users who might not prefer to leave the app and go through the tutorial on a web page. So my question is: Is it possible to make use of DocC tutorial and present the tutorial to my users in the app without leaving the app? Is not, the only solution would be to provide a link for my users to open the web page in Safari I guess. My second question is: Is it possible to host DocC tutorial on an Amazon S3 bucket?
Replies
1
Boosts
0
Views
906
Activity
Aug ’22
How to contribute to modify Developer Documentation?
Is there a way to contribute to Developer Documentation about the Core Data framework? I've found the wrong part in the developer document. I'd like to correct this. I wanted to modify it by sending a pull request from github, but I couldn't find where I could do it in apple's github. Can you give me some advice on what to do? Thank you in advance for your help! :)
Replies
1
Boosts
0
Views
1.1k
Activity
Aug ’22
Build Documentation in App for binary frameworks distributed over SPM
Given is an app project with two SPM dependencies: one to a source code repro and one to a repro containing in XCFramework. Using "Build Documentation" in Xcode generates the documentation for the app and source framework but not for the XCFramework. Wonder, why the documentation is not generated from the symbol graph of the binary Tried to create a .doccarchive with the framework using "Build Documentation during 'Build'" build setting, but: .doccarchive is not copied when creating a XCFramework after adding .doccarchive to XCFramework, it will not be resolved and downloaded via SPM Is there any way to distribute the documentation of my binary framework over SPM to be displayed in the Documentsbrowser using the "Build Documentation" command?
Replies
1
Boosts
2
Views
1.4k
Activity
Aug ’22
Configure hosting base url
How to add hosting base URL to a package(not a project)? is it possible to add an existing Swift package to my project as a target?
Replies
0
Boosts
0
Views
1.1k
Activity
Aug ’22
DocC: How to write content from another file in documentation
I want to lint my documentation without having to run vale checks throughout the code. So I created "testing-docs.md", added content like "This is a testing document for linting checks." Now in my class, I have added my documentation in comment like stated by Apple. /// <testing-docs.md> /// -Parameters: /// - token: conn123 /// - payload: nothing for now /// - fromViewController: <#fromViewController description#> /// - completion: <#completion description#> Is there a way that instead of <testing-docs.md>, I get the file's content displayed "This is a testing document for linting checks." I don't want to do it manually because I want to lint content separately. I have multiple md files.
Replies
1
Boosts
0
Views
1.6k
Activity
Jul ’22
Error while generating a DocC based documentation for a Swift Package
I want to generate a DocC documentation for an internal Swift Package with the help of SwiftDocC plugin using the following command: The internal framework uses realm-core and realm-cocoa. $ swift package --disable-sandbox preview-documentation --product InternalFramework Actual Results If I build the DocC files via Xcode the build documentation is generated. But if I use the above command on the terminal to generate. There is an error shown on the terminal and the framework fails to build the documentation. The following is the error shown on the terminal Computing version for https://github.com/realm/realm-cocoa.git Computed https://github.com/realm/realm-cocoa.git at 10.28.1 (0.64s) Computing version for https://github.com/realm/realm-core Computed https://github.com/realm/realm-core at 12.1.0 (0.36s) error: Couldn’t update repository submodules: fatal: could not get a repository handle for submodule 'tools/vcpkg/ports' I do not understand whether it is a DocC based issue or a realm issue. Steps & Code to Reproduce Running the following command causes the error: $ swift package --disable-sandbox preview-documentation --product InternalFramework I am not able to understand the root cause of the error.
Replies
1
Boosts
0
Views
1.5k
Activity
Jul ’22
Docc is support multiple language comments?
Docc is support multiple language comments? I need to use Docc to document my project. The document for the project I will be working on is in a situation where both Korean and English are required. If multiple language comments support is available, can I know the related materials?
Replies
1
Boosts
0
Views
1.8k
Activity
Jun ’22
Does Swift DocC Plugin support iOS frameworks?
I encountered an issue that I could use the SPM DocC plugin to produce documentation. Will the new version of the Xcode 14 and SPM DocC plugin allow to build directly the documentation using the plugin for the frameworks that e.g. use the UIKit frameworks? When I try to run the plugin and in addition pass sdk and target parameters swift package -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios15.3-simulator" --allow-writing-to-directory ./docs generate-documentation --target UIEnvironment Building for debugging... Build complete! (0.09s) Generating documentation for 'UIEnvironment'... Building for debugging... Build complete! (0.07s) error: 'UIEnvironment' does not contain any documentable symbols or a DocC catalog and will not produce documentation More about it on the Swift Forums: https://forums.swift.org/t/swift-docc-plugin-for-swiftpm/54725/30 Currently, I resolve to directly use Swift DocC rm -rf .build; mkdir -p .build/symbol-graphs \ && swift build --target UIEnvironment \ -Xswiftc "-sdk" \ -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" \ -Xswiftc "-target" \ -Xswiftc "arm64-apple-ios15.4-simulator" \-Xswiftc -emit-symbol-graph \ -Xswiftc -emit-symbol-graph-dir -Xswiftc .build/symbol-graphs; mkdir -p .build/swift-docc-symbol-graphs \ && mv .build/symbol-graphs/UIEnvironment* .build/swift-docc-symbol-graphs; export DOCC_HTML_DIR="$(dirname $(xcrun --find docc))/../share/docc/render"; rm -rf docs-out; mkdir -p docs-out/main \ && ../swift-docc/.build/debug/docc convert Sources/UIEnvironment/Documentation.docc \ --fallback-display-name UIEnvironment \ --fallback-bundle-identifier com.plum.UIEnvironment \ --fallback-bundle-version 1.0.0 \ --additional-symbol-graph-dir .build/swift-docc-symbol-graphs \ --transform-for-static-hosting \ --hosting-base-path /UIEnvironment/main \ --output-path docs-out/main; cp -R docs-out/main main another solution is to use xcodebuild docbuild Is it an expected shortcoming that cannot be resolved because of the multiplatform nature of SPM or just a temporary limitation?
Replies
1
Boosts
0
Views
2.2k
Activity
Jun ’22
Does DocC work for Objective-C libraries
Hi, I believe its pretty clear but to confirm, does DocC work with Objective-C based products, i.e static frameworks / libraries?
Replies
2
Boosts
0
Views
3.0k
Activity
Jun ’22
Will DocC get improved one day to include C++ and Objective-C source code documentation?
I'm still using all business logic in Objective-C++ for easier use of our C++ code. Looks nicer than what I get from Doxygen
Replies
2
Boosts
0
Views
2.4k
Activity
Jun ’22
Can we use DocC to compile Documentation for Apps?
Can we use DocC to compile Documentation for Apps?
Replies
2
Boosts
0
Views
1.6k
Activity
Jun ’22
DocC for something else than Swift.
Hello My projects are all in C and Objective-C and have a 0% chance to ever use Swift (portability is super important for me). However I love to write code in Xcode and the new DocC feature looks like something you definitively want to support. Now I set up a test project and it seems to be that DocC does only work in Swift. If you annotate plain-C functions it produces zero output. Not even a workspace documentation entry pops up. Given Apple has plenty of documentation pointing to Unix C functions and Apple libraries you can call in C, I find it rather strange that this doesn't work. Is this intentionally or am I missing a few additional things to make it work for C?
Replies
2
Boosts
0
Views
1.2k
Activity
Jun ’22
How to link to Apple Documentation (external framework) within DocC?
Does anyone know how to create a link to a type/symbol within another framework from within your DocC documentation? As an example if I wanted to reference UIKit's UIDevice from within one of my type's overview, property, function, etc. I didn't catch this in any of the videos or documentation but I may have simply missed it.
Replies
0
Boosts
2
Views
1.2k
Activity
May ’22
Can DocC Generate Documentation for Extensions?
Is there a way to force the documentation compiler to generate documentation for extensions to types outside a package/framework? This is incredibly important, as some packages and frameworks extend types that are part of the Swift Foundation (e.g., extensions to primitive types and collection) and SwiftUI (e.g., view modifiers and environment values).
Replies
5
Boosts
0
Views
2.7k
Activity
Apr ’22
Static Hosting Support using DocC
I'm able to create my documentation via Xcode-> Product -> Build Documentation and that creates MY_PROJ.docarchive. I can also create .docarchive using xcodebuild command Now I'm trying to convert/export my .docarchive to host it in static space so that I can host it on Github pages. I'm using https://github.com/apple/swift-docc to convert my docarchive using the following command, swift run docc process-archive transform-for-static-hosting <path/to/docarchive> --output-path <destination_path> I can see the files exported in output-path which I believe is the files that I need to deploy in static hosting space. But when I host the same files in my local server or Github pages, they are still blank. Not sure what's wrong here.
Replies
3
Boosts
0
Views
4.1k
Activity
Apr ’22
Document extensions
Hi guys ;-) I've been implementing a small package that mainly consist of extensions. I added my documentation as usual (visible with the quick help/doc shortcut) I wanted to use DocC to generate a more in depth documentation, but it seems that extensions are not supported. Right out of the box (w/o any doc catalog), if I generate the documentation, it's empty. I can add a Doc Catalog, but I can't make any link to my files since there are no classes per se. MyPackage. gives nothing :-/ Is there a way to achieve that ? Thx.
Replies
5
Boosts
0
Views
1.2k
Activity
Feb ’22
How to host multiple docarchives on a single http server?
I have a few different projects and a ton of tutorials I want to host on the same http server... is this possible? I watched the Host and automate your DocC documentation session, but it seemed to only work with those rules for one docarchive. I know someone filed feedback for prefixes (https://developer.apple.com/forums/thread/682276)... is this possible already? Thanks.
Replies
3
Boosts
0
Views
3.3k
Activity
Feb ’22