WWSignInWith3rd_GitHub

main

Use GitHub third-party login.
William-Weng/WWSignInWith3rd_GitHub

WWSignInWith3rd+GitHub

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

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

Function - 可用函式

函式 功能
configure(clientId:secret:callbackURL:scope:) 參數設定
loginWithWeb(presenting:completion:) 登入 - 網頁
logoutWithWeb(contains:completion:) 登出 - 清除GitHub偷偷存在WebView裡面的Cookie值 => 記錄登入的值

Example

import UIKit
import WWPrint
import WWSignInWith3rd_Apple
import WWSignInWith3rd_GitHub

final class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        initSetting()
    }
    
    /// [GitHub 第三方登入](https://developer.github.com)
    @IBAction func signInWithGithub(_ sender: UIButton) {
        
        WWSignInWith3rd.GitHub.shared.loginWithWeb(presenting: self) { result in
            wwPrint(result)
        }
    }
}

// MARK: - 小工具
extension ViewController {
    
    func initSetting() {
        
        let clientId = "<clientId>"
        let secret = "<secret>"
        let callbackURL = "<callbackURL>"
        
        WWSignInWith3rd.GitHub.shared.configure(clientId: clientId, secret: secret, callbackURL: callbackURL)
    }
}

Description

  • Swift Tools 5.6.0
View More Packages from this Author

Dependencies

Last updated: Mon Apr 15 2024 04:38:13 GMT-0900 (Hawaii-Aleutian Daylight Time)