Unified Runtime:
Single Source, Native Artifacts
Tfkity abstracts the underlying Operating System via the global os namespace. Write logic once; the compiler generates platform-specific
implementations for iOS (Swift), Android (Kotlin), and Web (JS Bundle).
1. Generalized OS API
Instead of writing separate Java interfaces for Android and
Swift bridges for iOS, Tfkity provides the os.*
global namespace. This is a unified abstraction layer. When you
call a method here, the compiler injects the appropriate native
code for the target platform during the build process.
// Works on iOS, Android, and Web PWA async function requestAccess() { // Maps to UNUserNotificationCenter (iOS) & NotificationManager (Android) const permission = await os.askNotificationPermission(); if (permission === 'granted') { // Native vibration haptics os.haptics.success(); } }
2. Platform Specific Overrides
Sometimes generalization isn't enough. You may want to use a feature that only exists on one OS (e.g., AirDrop on iOS). You can access these via `os.ios` or `os.android`.
Note: The compiler performs "Tree Shaking." If you write `os.ios.doAirdrop()`, that line is completely stripped out when compiling the Android APK, preventing runtime errors.
function shareFile(fileData) { // 1. Try Universal Share Sheet first os.share({ title: "My Project", file: fileData }); // 2. Add iOS specific behavior (Ignored on Android) if (os.platform === 'ios') { os.ios.doAirdrop(fileData); } }
3. Build Artifacts
iOS / iPadOS
Compiles to Swift via Xcode Project generation. Uses Metal for rendering.
Android
Compiles to Kotlin/JVM. Uses Vulkan for rendering logic.
Web / PWA
Hydrated SPA or SSR depending on config. SEO Optimized.