目录
目录README.md

tvOS Keyboard component

tvOS keyboard

A custom keyboard component for tvOS app development.

Features

  • This tvOS Keyboard can be used in any UIViewController.
  • You can enter text, numbers, and other characters using the touchpad.
  • Support for all input languages.
  • The keyboard style is almost identical to the native component, but can be changed if the developer wishes.
  • Ability to specify a focus element for switching from a component.

Swift Package Manager Install

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It is in early development, but Alamofire does support its use on supported platforms.

Once you have your Swift package set up, adding TVOSKeyboard as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/goldenplan/TVOSKeyboard", .upToNextMajor(from: "0.1.0"))
]

Example use tvOS Keyboard

With the powerful options, you can do hard tasks with tvOS Keyboard in a simple way. For example, the code below:

  1. Use Storyboard or code to create a keyboard component.
    import TVOSKeyboard
    @IBOutlet weak var keyboardView: KeyboardView!
  1. Create your own set of characters to enter or use one of the preset ones.
    let eng = KeyboardDescription(code: "en", type: .letters, simbols: "abcdefghijklmnopqrstuvwxyz", label: "abc", spaceName: "space")
  1. Create a configuration object and change the default values if necessary.
    let config = KeyboardConfig()
    config.keyboardDescriptions = [
        eng,
        Presets.rus
    ]
    config.topFocusedElement = button
    config.isUppercasedOnStart = true
    config.allowNumeric = false
    config.allowSimbolic = true
    config.allowSpaceButton = false
    config.allowDeleteButton = false
    config.hideOptionalPanel = false
    keyboardView.config = config
    keyboardView.delegate = self
  1. Specify as a delegate your ViewController or other object that will be responsible for processing data from the keyboard. To do this the delegate must first be signed under the KeyboardViewProtocol.
public protocol KeyboardViewProtocol: class {
    func addSimbol(_ value: String)
    func deleteSimbol()
    func swipeFromDown()
    func deleteLongPress()
    func updateString(_ cachedString: String)
    func performFocus(element: UIView)
}

Requirements

  • tvOS 13.0+
  • Swift 5.0+

Contact

If you find an issue, just open a ticket. Pull requests are warmly welcome as well.

License

TVOSKeyboard is released under the MIT license. See LICENSE for details.

邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

©Copyright 2023 CCF 开源发展委员会
Powered by Trustie& IntelliDE 京ICP备13000930号