Nikita Lipsky
2 years ago
committed by
GitHub
6 changed files with 24 additions and 111 deletions
@ -1,37 +1,8 @@ |
|||||||
import androidx.compose.ui.window.Application |
import androidx.compose.ui.window.Application |
||||||
import kotlinx.cinterop.* |
import androidx.compose.ui.main.defaultUIKitMain |
||||||
import platform.UIKit.* |
|
||||||
import platform.Foundation.* |
|
||||||
|
|
||||||
fun main() { |
fun main() { |
||||||
val args = emptyArray<String>() |
defaultUIKitMain("Chat", Application("Chat") { |
||||||
memScoped { |
ChatApp() |
||||||
val argc = args.size + 1 |
}) |
||||||
val argv = (arrayOf("skikoApp") + args).map { it.cstr.ptr }.toCValues() |
|
||||||
autoreleasepool { |
|
||||||
UIApplicationMain(argc, argv, null, NSStringFromClass(SkikoAppDelegate)) |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
class SkikoAppDelegate : UIResponder, UIApplicationDelegateProtocol { |
|
||||||
companion object : UIResponderMeta(), UIApplicationDelegateProtocolMeta |
|
||||||
|
|
||||||
@ObjCObjectBase.OverrideInit |
|
||||||
constructor() : super() |
|
||||||
|
|
||||||
private var _window: UIWindow? = null |
|
||||||
override fun window() = _window |
|
||||||
override fun setWindow(window: UIWindow?) { |
|
||||||
_window = window |
|
||||||
} |
|
||||||
|
|
||||||
override fun application(application: UIApplication, didFinishLaunchingWithOptions: Map<Any?, *>?): Boolean { |
|
||||||
window = UIWindow(frame = UIScreen.mainScreen.bounds) |
|
||||||
window!!.rootViewController = Application("Chat") { |
|
||||||
ChatApp() |
|
||||||
} |
|
||||||
window!!.makeKeyAndVisible() |
|
||||||
return true |
|
||||||
} |
|
||||||
} |
} |
||||||
|
Loading…
Reference in new issue