LineLoginUrlHandler

The one thing LINE Login needs from your iOS app.

When the LINE app is not installed, login happens in a web view and LINE hands control back through a URL. Something in the app has to pass that URL on, or the login never completes — the browser closes, and nothing happens.

From SwiftUI:

ContentView()
.onOpenURL { url in
_ = LineLoginUrlHandler.shared.handle(url: url)
}

From a UIKit AppDelegate, forward both entry points — the second one only matters when universalLinkUrl is configured, which makes forgetting it fail intermittently and confusingly:

func application(_ app: UIApplication, open url: URL, options: …) -> Bool {
LineLoginUrlHandler.shared.handle(url: url)
}

func application(_ app: UIApplication, continue userActivity: NSUserActivity, …) -> Bool {
guard let url = userActivity.webpageURL else { return false }
return LineLoginUrlHandler.shared.handle(url: url)
}

A SwiftUI App is scene-based, and UIKit delivers incoming URLs to the scene — so in a SwiftUI app application(_:open:options:) is never called and .onOpenURL is the only thing that works.

Functions

Link copied to clipboard
fun handle(url: NSURL): Boolean

Hands url to the LINE SDK.