How snmac/sykeyboard works
Project Type and Purpose
• This is an iOS application that provides a custom keyboard extension (SYKeyboard) plus two extension targets (EnglishKeyboard and HangeulKeyboard), built in Swift/SwiftUI and UIKit. Users install the SYKeyboard host app to configure settings, and then enable one or more keyboard extensions in the system keyboard settings.
Main Components
A. Host App (SYKeyboard)
• SwiftUI/App entry (SYKeyboardApp.swift, ContentView.swift)
• Settings screens (KeyboardSettings/*)
• Instructions tab (InstructionsTab/*)
• Preview/Test view (KeyboardTestView.swift)
• Models and Utils (SupportEmail.swift, custom view modifiers and extensions)
B. Keyboard Extension Targets
1. EnglishKeyboard
– ViewController: EnglishKeyboardViewController
– Presentation/View/Layout: EnglishKeyboardView & its protocol
– Resources: Entitlements, Info.plist, xcconfig
2. HangeulKeyboard
– ViewController: HangeulKeyboardViewController
– Presentation/View/Layout: CheonjiinKeyboardView, NaratgeulKeyboardView
– Resources: Entitlements, InfoPlist.xcstrings, Localizable.xcstrings, xcconfig
C. Common Module
• Shared code for both keyboards and host:
– FeedbackManager.swift, UserDefaultsManager.swift
– Utils (DefaultValues, OneHandedMode, UserDefaultsKeys)
– Presentation components: Buttons, Overlays, GestureControllers, Layout Views under Keyboards/Common/Presentation
D. External Services
• Firebase Analytics
• Google AdMob (via Pods/GAD)
• Meta Audience Network (Pods/FBAudienceNetwork.xcframework)
E. Persistence and Configuration
• UserDefaults (via UserDefaultsManager) for storing keyboard height, one-handed mode, repeat rate, etc.
• Build configurations via xcconfig files (Debug/Release for each target).
F. Dependency Management
• CocoaPods (Podfile, Pod targets for each extension)
• Swift Package Manager (SPM) if any non-CocoaPods dependencies
Relationships and Interactions
• The Host App reads/writes user settings (UserDefaults) via singleton managers.
• Keyboard extensions import the Common module; they fetch stored settings and configure UI (height, one-handed offset, key repeat) accordingly.
• UI interactions in the extension (button taps, gestures) route through GestureControllers → Button Protocols → FeedbackManager (haptic) → delegate back to the extension’s textDocumentProxy.
• Both the Host App and Extensions log events to Firebase Analytics.
• Ad components (AdMob, Meta Audience) load ads in the Host App’s BannerView.
Architectural Patterns & Design Principles
• MVVM-ish / Presenter-style separation:
• Views (SwiftUI + UIKit UIView subclasses) ↔ ViewControllers
• Delegate Pattern: KeyboardViewController delegates text insertion/deletion to UITextDocumentProxy.
• Singleton Pattern: FeedbackManager, UserDefaultsManager.
• Modularization: Common code is factored into a separate module/directory, imported by all targets.
Technologies and Frameworks to Annotate
• SwiftUI (Host App)
• UIKit (Keyboard Extensions)
• SnapKit + Then (Auto Layout DSL)
• Swift Package Manager + CocoaPods (dependency managers)
• Firebase Analytics, Google AdMob, Meta Audience Network
• UserDefaults (local storage)
Essential Elements Checklist
• Clear labels on each module/component
• Notes on architectural patterns (delegate, singleton) where they apply