Coder Social home page Coder Social logo

flicktypekit's Introduction

FlickType icon FlickType screenshot FlickType screenshot

FlickTypeKit 🚀

Build Status

“Best of 2020” - Apple
“Apple Watch App of the Year” - AppAdvice
“Makes Typing a Breeze” - Forbes

Add a powerful keyboard to your watchOS apps and dramatically improve the text input experience for users. Leverage full typing and editing capabilities to greatly enhance existing parts of your app, or enable entirely new features like messaging and note-taking directly on Apple Watch.

SwiftUI

Use a FlickTypeTextEditor to display an editable text interface and gather text input from the user:

import FlickTypeKit

struct ContentView: View {
  @State private var text = ""
  var body: some View {
    ScrollView {
      VStack {
        // other views here...
        FlickTypeTextEditor(text: $text)
        // more views here...
      }
    }
  }
}

WatchKit

Modify your presentTextInputController() calls to include the flickType argument:

import FlickTypeKit

presentTextInputController(
  withSuggestions: nil,
  allowedInputMode: .allowEmoji,
  flickType: .ask) { items in
  if let text = items?.first as? String {
    print("User typed text: \(text)")
  }
}

.ask will offer a choice between FlickType and the standard input methods (recommended).
.always will always open FlickType, skipping the input method selection.
.off will present the standard input method selection without the FlickType option.

Note: When using WatchKit, the optional startingText argument can be used to support editing of existing text with FlickType. In SwiftUI, FlickTypeTextEditor does that automatically for you.

Integration

Swift Package Manager

https://github.com/FlickType/FlickTypeKit

This version of FlickTypeKit will only show FlickType as an input option to users on watchOS 7 or later. FlickTypeKit uses universal links to switch from your app to the FlickType Keyboard app, and then return the input text back to you. Thus the keyboard stays up-to-date without you having to update your app, and leverages the user's custom settings and dictionary. To support universal links in your app:

  1. Add an applinks associated domain entitlement to your watch extension target: Associated domains screenshot

  2. Create a file named apple-app-site-association (without an extension) with the following contents, and place it in your site’s .well-known directory:

{
  "applinks": {
      "details": [
           {
             "appIDs": [ "<Team ID>.your.watchkitextension.identifier" ],
             "components": [
               {
                  "/": "/flicktype/*",
                  "comment": "Matches any URL whose path starts with /flicktype/"
               }
             ]
           }
       ]
   }
}

The file’s URL should match the format https://your.app.domain/.well-known/apple-app-site-association and must be hosted with a valid certificate and with no redirects.

  1. Add the following inside your WKExtensionDelegate.applicationDidFinishLaunching():
FlickType.returnURL = URL(string: "https://your.app.domain/flicktype/")
  1. Add the following inside your WKExtensionDelegate.handle(_ userActivity: NSUserActivity):
if FlickType.handle(userActivity) { return }

Help & support

  • The sample app contains implementations for both SwiftUI & WatchKit.
  • Join our Discord
  • Email us!

flicktypekit's People

Contributors

keleftheriou avatar pixlwave avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.