-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update package to use a binary url and checksum
- Loading branch information
1 parent
a9b4e38
commit 130a35f
Showing
32 changed files
with
83 additions
and
9,868 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,82 @@ | ||
# Getting started | ||
|
||
Once KeyboardKit is added to your project, you need to obtain a license before you can start using it in your application. | ||
Once KeyboardKit is added to your project, you need to obtain a license before you can start using it in your application and extension. | ||
|
||
|
||
|
||
## How to obtain a license | ||
|
||
You can purchase a commercial license from the [KeyboardKit website][Licenses]. The website contains all information about price, tiers, features etc. | ||
KeyboardKit Pro requires a commercial license. The [KeyboardKit website][Licenses] website has information about license price, tiers, features etc. | ||
|
||
|
||
|
||
## How to use KeyboardKit Pro | ||
## How to use KeyboardKit | ||
|
||
You can use KeyboardKit Pro in both your main application and your keyboard extension: | ||
You can use KeyboardKit in different ways in various app targets: | ||
|
||
* The main app can use KeyboardKit Pro's views to show if a keyboard is enabled, if full access is granted etc. | ||
* The keyboard extension can use KeyboardKit Pro to unlock more functionality than is available in KeyboardKit. | ||
* Keyboard extensions can use KeyboardKit to create more powerful keyboards. | ||
* Main apps can use KeyboardKit to check if a keyboard is enabled, has full access etc. | ||
* Main apps can create KeyboardKit-based input controllers and use them for its text fields. | ||
* Other targets can use KeyboardKit to build upon its functionality. | ||
|
||
Other platforms, such as macOS, watchOS and tvOS can use KeyboardKit as well, even though creating custom keyboards on those platforms may not be the most common use-case. | ||
|
||
For instance, KeyboardKit Pro unlocks localized services that make the `SystemKeyboard` support all keyboard locales, complete with the correct keyboard layouts, autocomplete, callout actions etc. | ||
|
||
|
||
## How to setup KeyboardKit Pro | ||
|
||
After setting up KeyboardKit and obtaining a license, you are ready to extend KeyboardKit with KeyboardKit Pro: | ||
In your extension, let `KeyboardViewController` inherit `KeyboardInputViewController` instead of `UIInputViewController`. This gives it access to additional functionality like new lifecycle functions, properties like `keyboardContext`, services like `keyboardActionHandler` etc. | ||
|
||
The controller will call `viewWillSetupKeyboard()` when the keyboard should be created or re-created. Instead of `setup(with:)`, use `setup(withLicenseKey:view:)` to setup KeyboardKit Pro with any `SwiftUI` view: | ||
|
||
```swift | ||
func viewWillSetupKeyboard() { | ||
super.viewWillSetupKeyboard() | ||
setupPro(withLicenseKey: "your-key", view: MyKeyboardView()) | ||
} | ||
``` | ||
|
||
This will make the provided view the main view of the keyboard extension, and cause the extension to resize to fit the view content. It will also inject all observable controller properties as environment objects into the view hierarchy. | ||
|
||
If you want to setup pro without setting up a view, you can just use `setupPro(withLicenseKey:)` instead: | ||
|
||
```swift | ||
func viewWillSetupKeyboard() { | ||
super.viewWillSetupKeyboard() | ||
setupPro(withLicenseKey: "your-key") | ||
// Then setup your view whenever and however you want | ||
} | ||
``` | ||
|
||
It's important that the view you use observes the global `keyboardContext`, either by using the injected environment object or by setting it up as an observed object, otherwise it will be unresponsive to context changes. If your view doesn't react when you tap the shift or numeric key, that is most probably the cause. | ||
|
||
|
||
|
||
## More on licenses | ||
|
||
Registering a valid license will setup the Pro features that the license includes, e.g. locales, autocomplete etc. You can then use all features that the license includes. Failure to register a license before accessing Pro features will cause features to throw a `LicenseError`. | ||
|
||
|
||
First make sure that you have installed both KeyboardKit and KeyboardKit Pro and that you import the libraries in all files where you need them. | ||
### How to register a license without a controller | ||
|
||
KeyboardKit Pro can now be setup with a single line of code: | ||
App targets that don't use an input controller and don't have the `setupPro` functions, can use `License.register(licenseKey:)` instead. | ||
|
||
* For keyboard extensions, call `setupPro(withLicenseKey:view:)` instead of `setup(with:)`. | ||
* For keyboard extensions, you can also use `setupPro(withLicenseKey:)` if you don't want to provide a view. | ||
* For applications, where `setupPro` is not available, use `KeyboardKitLicense.register(licenseKey:)` instead. | ||
* All these functions are throwing and must be called with `try` or `try?`. When they fail, they throw a `LicenseError`. | ||
|
||
Registering a valid license will setup Pro features that the license includes, e.g. supported locales, autocomplete engines etc. You can then use any features that your license includes in any way you like. | ||
### How to access your license | ||
|
||
Failure to register the license before accessing Pro features will result in initializers or functions throwing a `LicenseError`. | ||
After registering a valid license as described above, you can use the static `License.current` property to inspect your license information. | ||
|
||
|
||
## How to inspect your license | ||
### How to reconfigure your license | ||
|
||
After registering a valid license as described above, you can inspect it with `KeyboardKitLicense.current`. | ||
Registering a valid license will cause KeyboardKit to configure your application and extension according to the license configuration. If you want to use a different setup, you can reconfigure KeyboardKit after registering a valid license. Have a look at the demo app for examples. | ||
|
||
|
||
## Configuration | ||
|
||
Registering a valid license will cause KeyboardKit Pro to configure your application and extension according to the license configuration. | ||
## Going further | ||
|
||
If you want to use a different configuration, you can wait with configuring KeyboardKit until after registering a valid license. | ||
Have a look in the documentation for more articles on how to configure KeyboardKit, create your own service implementations etc. You can also have a look at the demo apps, which replace many services with demo-specific implementations. | ||
|
||
Have a look at the demo app for more information. | ||
|
||
|
||
[Licenses]: https://getkeyboardkit.com/pro |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.