Skip to content

Commit 9c85331

Browse files
committed
add publishing and quickstart pages for swift
1 parent 621c5d5 commit 9c85331

File tree

4 files changed

+156
-0
lines changed

4 files changed

+156
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: Swift configuration
3+
description: Configuration options for the Fern Swift SDK.
4+
---
5+
6+
You can customize the behavior of the Swift SDK generator in `generators.yml`:
7+
8+
```yaml {7-8} title="generators.yml"
9+
default-group: local
10+
groups:
11+
local:
12+
generators:
13+
- name: fernapi/fern-swift-sdk
14+
version: <Markdown src="/snippets/version-number-swift.mdx"/>
15+
```
16+
17+
## SDK Configuration Options
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: Publishing as a Swift package
3+
description: How to publish the Fern Go SDK to the Go module proxy.
4+
---
5+
6+
Publish your public-facing Fern Swift SDK as a Swift package distributed via Git. After following the steps on this page, you'll have a versioned package that developers can install using Swift Package Manager.
7+
8+
<Markdown src="/products/sdks/snippets/setup-fern-folder-callout.mdx"/>
9+
10+
## Configure `generators.yml`
11+
12+
<Steps>
13+
<Step title="Configure `output` location">
14+
Swift packages are distributed via Git repositories, so remove the auto-generated `output` and `config` properties. Instead, add the path to your GitHub repository:
15+
16+
```yaml {6-7} title="generators.yml"
17+
groups:
18+
swift-sdk:
19+
generators:
20+
- name: fernapi/fern-swift-sdk
21+
version: 1.0.0
22+
github:
23+
repository: your-org/company-swift
24+
```
25+
</Step>
26+
</Steps>
27+
28+
## Publish as a Swift package
29+
30+
At this point, you're ready to generate a release for your SDK.
31+
32+
<Steps>
33+
<Step title="Generate your release">
34+
Regenerate your SDK and publish it to your repository:
35+
36+
```bash
37+
fern generate --group swift-sdk --version <version>
38+
```
39+
40+
Local machine output will verify that the release is pushed to your repository and tagged with the version you specified.
41+
</Step>
42+
43+
<Step title="Verify package availability">
44+
Your Swift package is now available! Developers can add it to their projects by:
45+
46+
- **In Xcode**: File → Add Package Dependencies → Enter your repository URL
47+
- **In Package.swift**: Add to dependencies array:
48+
49+
```swift
50+
dependencies: [
51+
.package(url: "https://github.com/<github-org>/<github-repo-name>", from: "<version>")
52+
]
53+
```
54+
55+
<Tip>
56+
Unlike centralized registries, there's no separate "publishing" step required. Your package becomes available immediately once pushed to Git with proper tags.
57+
58+
You can optionally submit your package to the community-maintained [Swift Package Index](https://swiftpackageindex.com/) for better discoverability.
59+
</Tip>
60+
</Step>
61+
</Steps>
62+
63+
64+
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
title: Swift quickstart
3+
description: Get started quickly with the Fern Swift SDK.
4+
---
5+
6+
Generate a Swift SDK by following the instructions on this page.
7+
8+
<Markdown src="/products/sdks/snippets/setup-fern-folder-callout.mdx"/>
9+
10+
<Steps>
11+
<Markdown src="/products/sdks/snippets/pass-fern-check.mdx"/>
12+
13+
### Add the SDK generator
14+
15+
Run the following command to add the Swift SDK generator to `generators.yml`:
16+
17+
```bash
18+
fern add fern-swift-sdk --group swift-sdk
19+
```
20+
21+
<Note>
22+
`swift-sdk` is the name of the `generators.yml` group that configures your Swift
23+
SDK's output location and other metadata. You can customize this group name to
24+
differentiate between multiple SDKs across different languages (e.g.,
25+
`ruby-sdk`, etc) in your organization.
26+
</Note>
27+
28+
This command adds the following `group` to `generators.yml`:
29+
30+
```yaml title="generators.yml"
31+
swift-sdk: # group name
32+
generators:
33+
- name: fernapi/fern-swift-sdk
34+
version: <Markdown src="/snippets/version-number-swift.mdx"/>
35+
output:
36+
location: local-file-system
37+
path: ../sdks/swift
38+
```
39+
40+
### Generate the SDK
41+
42+
Run the following command to generate your SDK:
43+
44+
```bash
45+
fern generate --group swift-sdk
46+
```
47+
48+
<Markdown src="/products/sdks/snippets/generate-sdk.mdx"/>
49+
50+
```bash
51+
fern/ # created by fern init
52+
sdks/ # created by fern generate --group swift-sdk
53+
├─ swift
54+
├─ Package.swift
55+
└─ Sources
56+
├─ ApiClient.swift
57+
├─ Schemas/
58+
├─ Public/
59+
├─ Core/
60+
└─ Resources/
61+
```

fern/products/sdks/sdks.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,20 @@ navigation:
179179
slug: changelog
180180
- link: Customer showcase
181181
href: https://buildwithfern.com/showcase#sdk-customers.ruby
182+
- section: Swift
183+
contents:
184+
- page: Quickstart
185+
path: ./overview/swift/quickstart.mdx
186+
slug: quickstart
187+
- page: Configuration
188+
hidden: true
189+
path: ./overview/swift/configuration.mdx
190+
slug: configuration
191+
- page: Publishing as a Swift package
192+
path: ./overview/swift/publishing-to-swift-package-manager.mdx
193+
slug: publishing
194+
- changelog: ./overview/swift/changelog
195+
slug: changelog
182196
- page: MCP Server
183197
path: ./overview/mcp-server/introduction.mdx
184198
slug: mcp-server

0 commit comments

Comments
 (0)