Skip to content

Commit 4c66afe

Browse files
committed
Streamline documentation with some proofreading
1 parent a4f40ab commit 4c66afe

File tree

1 file changed

+46
-46
lines changed

1 file changed

+46
-46
lines changed

README.md

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@
44

55
# LinksKit
66

7-
Apple requires that every app must link to their privacy policy and additionally to the terms of use (if it has in-app purchases) as part of their guidelines. Most apps solve this by adding a "Links" section somewhere in their apps settings. And while at it, they also add some more links like to rate the app, to their FAQ or to get support. This package comes with all these common things built-in so you can save a lot of time while setting up these kinds of screens. And it even supports the most common place on macOS as well: the help menu!
7+
Every app on the App Store must provide essential links like a privacy policy and, if applicable, terms of use (for in-app purchases) to comply with Apple's guidelines. Many apps handle this by adding a "Links" section in their settings, including additional helpful links like app ratings, FAQs, and support options.
8+
9+
That's where LinksKit comes in: it offers **a simple, ready-to-use solution to handle all these common links**, saving you a ton of time. Whether it's legal, help, or app promotion links, LinksKit covers it. And for macOS, it even supports adding these links right into the **Help** menu!
10+
811

912
## Usage
1013

11-
Basically, you just need to `import LinksKit` and place a `LinksView()` somewhere inside a `List` or `Form` view. It will automatically create all the sections you need. But for the `LinksView` to know what links to present, you need to do some setup first:
14+
Getting started with LinksKit is easy. After adding the package to your project, simply `import LinksKit` and place a `LinksView()` inside a `List` or `Form` view. But before doing that, you'll need to configure the links you want to include.
1215

1316
### Minimal Setup
1417

15-
For the minimal variant which contains only the legal links and the app rating & contact email, you can add this code to your app entry point:
18+
For a basic setup, which includes legal links (like privacy policy and terms of use), app rating, and a contact email, you can configure LinksKit like this:
1619

1720
```swift
1821
import SwiftUI
@@ -37,19 +40,19 @@ struct YourApp: App {
3740
}
3841
```
3942

40-
> Tip: The `providerToken` is the `pt` query parameter in the campaign link of your app (e.g. ` https://apps.apple.com/app/apple-store/id123456789?**pt=123456**&ct=test1234&mt=8`). If you are new to campaign links, make sure to learn about them [here](https://developer.apple.com/help/app-store-connect/view-app-analytics/manage-campaigns) – they basically help you understand where people have discovered your app. Note that you don't have to create campaign links using App Store Connect over and over again – the `providerToken` is the same for all your apps and you can change the `campaignToken` (`ct` query parameter) to anything you like. LinksKit sends your apps Bundle ID as the campaign token by default, that's why you don't need to set it up.
43+
> **Tip:** The `providerToken` is part of your app's campaign link (look for the `pt` query parameter). Campaign links are a great way to track where users are finding your app. Learn more about them [here](https://developer.apple.com/help/app-store-connect/view-app-analytics/manage-campaigns). LinksKit automatically uses your app's Bundle ID as the campaign token, so no extra setup is needed.
4144
42-
> Note: LinksKit automatically adds the link to Apples terms of use for apps with in-app purchases to the `.legalLinks` sectionno action needed. It just works. 🚀
45+
> **Note:** LinksKit will automatically add Apple's terms of use link to `.legalLinks` for apps with in-app purchases. No need to configure it yourselfit just works! 🚀
4346
4447
### Optional Extras
4548

46-
LinksKit is fully customizable but comes also with built-in extras for your convenience:
49+
LinksKit goes beyond the basics, offering more customization to fit your needs. You can:
4750

48-
* `.helpLinks` also accepts an optional `faqURL` parameter if you have a link for common questions
49-
* `.socialMenus(appLinks:developerLinks:)` is for linking to your and/or your apps socials
50-
* `.appMenus(ownAppLinks:friendsAppLinks:)` is for linking to your other apps and/or some friends apps
51+
* Add an FAQ link with `faqURL` passed to `.helpLinks`
52+
* Link to your app's or developer's social media with `.socialMenus(appLinks:developerLinks:)`
53+
* Promote your other apps or apps from friends using `.appMenus(ownAppLinks:friendsAppLinks:)`
5154

52-
A real-world example from my app [TranslateKit](https://apps.apple.com/app/apple-store/id6476773066?pt=549314&ct=github.com&mt=8) that makes use of all these extras looks like this:
55+
Here’s a real-world example from my app [TranslateKit](https://apps.apple.com/app/apple-store/id6476773066?pt=549314&ct=github.com&mt=8), showcasing all of these features:
5356

5457
```swift
5558
init() {
@@ -111,35 +114,11 @@ func configureLinksKit() {
111114
}
112115
```
113116

114-
> Note: The reason `.ownApp` and `.friendsApp` are named differently is because LinksKit will automatically add your `providerToken` to your own apps while you need to pass your friends `publisherToken` using the optional parameter in case you know it.
115-
116-
### Custom Links & Menus
117-
118-
On top of the built-in convenience helpers `.helpLinks`, `.socialMenus`, `.appMenus`, and `.legalLinks`, you can also create own complete custom `LinkSection` instances and pass your own links. You can even nest them! For example, `.appMenus` is just a convenience for this equivalent `LinkSection`:
119-
120-
```swift
121-
LinkSection(
122-
title: "App Links",
123-
entries: [
124-
.menu(LinkMenu(
125-
title: "More Apps from Developer",
126-
systemImage: "plus.square.on.square",
127-
linkSections: [ownDeveloperApps, ownConsumerApps, ownVisionApps]
128-
)),
129-
.menu(LinkMenu(
130-
title: "Apps from Friends",
131-
systemImage: "hand.thumbsup",
132-
linkSections: [nicosApps, jansApps]
133-
)),
134-
]
135-
)
136-
```
137-
138-
The `entries` parameter accepts one of `.menu(LinkMenu)` or `.link(Link)` and you can nest as many levels as SwiftUI supports (`.menu` becomes a `Menu` view, `.link` a `Button`).
117+
> **Note:** The `.ownApp` and `.friendsApp` helpers behave differently for a reason. LinksKit will automatically append your `providerToken` for your own apps, while you'll need to manually include a `publisherToken` for your friends’ apps if you know it.
139118
140119
### View Setup
141120

142-
For all platforms except macOS, it's common to have a settings screen with a `Form` or `List`. Just add `LinksView()` inside it like so:
121+
To add LinksKit to your app’s settings screen, typically structured as a `Form` or `List`, just insert a `LinksView()` like so:
143122

144123
```swift
145124
import SwiftUI
@@ -157,14 +136,11 @@ struct SettingsView: View {
157136
}
158137
```
159138

160-
That's it – really! You can even remove the `#if !os(macOS)` check if your app doesn't natively support macOS.
161-
162-
The result on non-Mac platforms should look like this:
139+
And that’s it! If you’re not targeting macOS, the result should look like this:
163140

164141
<img src="https://raw.githubusercontent.com/FlineDev/LinksKit/main/Images/PhoneSettings.jpeg" />
165142

166-
167-
When targeting macOS, it's more common to put links into the `Help` menu bar instead of the Settings screen. To do this just add `LinksView()` to your commands menu like so:
143+
For macOS apps, the best place for these links is often in the Help menu. You can easily add a `LinksView()` to the menu bar:
168144

169145
```swift
170146
import SwiftUI
@@ -185,17 +161,41 @@ struct YourApp: App {
185161
}
186162
```
187163

188-
You need to pass `.labelStyle(.titleAndIcon)` to see the icons here, because by default, the menu entries use the `.titleOnly` label style.
189-
190-
The result on Mac will look something like this:
164+
Here’s what that will look like on macOS:
191165

192166
<img src="https://raw.githubusercontent.com/FlineDev/LinksKit/main/Images/MacHelpMenu.jpeg" />
193167

168+
### Custom Links & Menus
169+
170+
If the default helpers like `.helpLinks` or `.appMenus` don't fit your exact use case, you can create fully custom `LinkSection` instances and add your own links. You can even nest them! For example, `.appMenus` is just a convenience for this equivalent `LinkSection`:
171+
172+
173+
```swift
174+
LinkSection(
175+
title: "App Links",
176+
entries: [
177+
.menu(LinkMenu(
178+
title: "More Apps from Developer",
179+
systemImage: "plus.square.on.square",
180+
linkSections: [ownDeveloperApps, ownConsumerApps, ownVisionApps]
181+
)),
182+
.menu(LinkMenu(
183+
title: "Apps from Friends",
184+
systemImage: "hand.thumbsup",
185+
linkSections: [nicosApps, jansApps]
186+
)),
187+
]
188+
)
189+
```
190+
191+
The `entries` parameter accepts one of `.menu(LinkMenu)` or `.link(Link)` and you can nest as many levels as SwiftUI supports (`.menu` is rendered as a `Menu` view, `.link` as a `Button`).
192+
194193
### Localization
195194

196-
All texts that are built-in to LinksKit are pre-localized to all [the same ~40 languages supported by iOS](https://www.apple.com/ios/feature-availability/#system-language-system-language). No action needed. If you need more languages, please open an issue on GitHub – I'm happy to add more.
195+
All of LinksKit's built-in strings are already localized in around 40 languages, covering all the languages supported by iOS. No setup is needed. If you require additional languages, feel free to open an issue on GitHub – I’m happy to add them!
196+
197+
If you need to localize the names of your apps or any other passed text, you can use `String(localized:)` as usual in your app.
197198

198-
If you want to localize any other text you pass to LinksKit APIs such as the names of your apps, just use `String(localized: "your-text")` and localize the text in your apps String Catalog as usual.
199199

200200
## Showcase
201201

0 commit comments

Comments
 (0)