Hi Can you please share how to close an app on iOS...
# multiplatform
a
Hi Can you please share how to close an app on iOS? On Android we can do something like:
Copy code
fun Context.findActivity(): ComponentActivity? = when (this) {
    is ComponentActivity -> this
    is ContextWrapper -> baseContext.findActivity()
    else -> null
}

LocalContext.current.findActivity()?.finish()
but what about iOS? Thanks in advance
f
No official way to close an app on iOS. But you can still use Exit or some alternative, but it’s not clean close, it’s like crashing the app.
👍 1
j
You showed closing an Android Activity in your snippet, the same thing on iOS would be closing a ViewController by using
dismiss
or
popViewController
API depending on if your showing View from a nav controller or a standalone view controller.
f
@Jason you can’t close properly by code an iOS application, it’s by design