项目介绍

FlickType/FlickTypeKit 是一个托管在 GitHub 上的开源项目,主要使用 Swift 编写,目前获得 119 个 Star、13 次 Fork。

仓库全名
FlickType/FlickTypeKit
Star 数
119
Fork 数
13
未关闭 Issue
7

README 摘要

FlickTypeKit 🚀 “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…

完整内容见 GitHub 原始 README 或本页 。

常见问题

FlickTypeKit 用什么语言开发?

主要使用 Swift 编写,目前有 119 个 Star。

如何获取 FlickTypeKit 的源码?

可以直接克隆仓库:git clone https://github.com/FlickType/FlickTypeKit.git,默认分支为 main;安装与运行步骤见仓库 README。

FlickTypeKit 最近还在维护吗?

仓库最近一次更新为 2024年1月1日,当前有 7 个未关闭 Issue;Star 数为 119,可作为社区活跃度的参考。

关于

A powerful keyboard for your Apple Watch app

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
151
价值分
75
活跃状态
活跃

语言占比

Swift

Release

README

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("Message", 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 }

Note: Always test on a real device, since the Simulator does not support app switching via universal links yet.

Help & support

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

评论

暂无评论