WWSignInWith3rd_LINE

main

Use LINE third-party login
William-Weng/WWSignInWith3rd_LINE

WWSignInWith3rd+LINE

Swift-5.6 iOS-14.0 Swift Package Manager-SUCCESS LICENSE

dependencies: [
    .package(url: "https://github.com/William-Weng/WWSignInWith3rd_LINE.git", .upToNextMajor(from: "1.1.0"))
]

Function - 可用函式

函式 功能
configure(channelId:channelSecret:universalLinkURL:) 參數設定
login(presenting:permissions:completion:) 登入
loginButton(with:viewController:completion:) LINE圖示按鍵
canOpenURL(_:open:options:) 在外部由URL Scheme開啟 -> application(_:open:options:)
canOpenUniversalLink(_:continue:restorationHandler:) 在外部由UniversalLink開啟 -> application(_:continue:restorationHandler:)

Example

import UIKit
import WWSignInWith3rd_Apple
import WWSignInWith3rd_LINE

@main
final class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?
    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        return true
    }
}

// MARK: - 相關設定
extension AppDelegate {
    
    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
        _ = WWSignInWith3rd.LINE.shared.canOpenURL(app, open: url, options: options)
        return true
    }
    
    func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
        _ = WWSignInWith3rd.LINE.shared.canOpenUniversalLink(application, continue: userActivity, restorationHandler: restorationHandler)
        return true
    }
}
import UIKit
import WWPrint
import WWSignInWith3rd_Apple
import WWSignInWith3rd_LINE

final class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        initSetting()
    }
    
    /// [Line 第三方登入](https://developers.line.biz)
    @IBAction func signInWithLine(_ sender: UIButton) {
        
        WWSignInWith3rd.LINE.shared.login(presenting: self) { result in
            wwPrint(result)
        }
    }
}

// MARK: - 小工具
extension ViewController {
    
    func initSetting() {
        
        let channelId = "<channelId>"
        let channelSecret = "<channelSecret>"
        let universalLinkURL = "<universalLinkURL>"
        
        WWSignInWith3rd.LINE.shared.configure(channelId: channelId, channelSecret: channelSecret, universalLinkURL: universalLinkURL)
    }
}

Description

  • Swift Tools 5.6.0
View More Packages from this Author

Dependencies

Last updated: Mon Mar 18 2024 05:14:12 GMT-0900 (Hawaii-Aleutian Daylight Time)