Extensions

The following extensions are available globally.

  • Declaration

    Swift

    extension Auth: ReactiveCompatible
  • 카카오 로그인의 주요 기능을 제공하는 클래스입니다.

    이 클래스를 이용하여 카카오톡 간편로그인 또는 웹 쿠키를 이용한 로그인을 수행할 수 있습니다.

    카카오톡 간편로그인 예제입니다.

    // 로그인 버튼 클릭
    if (AuthApi.isKakaoTalkLoginAvailable()) {
        AuthApi.shared.rx.loginWithKakaoTalk()
            .subscribe(onNext: { (token) in
                print(token)
            }, onError: { (error) in
                print(error)
            })
            .disposed(by: self.disposeBag)
    }
    
    // AppDelegate
    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
        if (AuthController.isKakaoTalkLoginUrl(url)) {
            if AuthController.handleOpenUrl(url: url, options: options) {
                return true
            }
        }
        ...
    }
    

    웹 로그인 예제입니다.

    AuthApi.shared.rx.loginWithKakaoAccount()
        .subscribe(onNext: { (token) in
            print(token.accessToken)
        }, onError: { (error) in
            print(error)
        })
        .disposed(by: self.disposeBag)
    

    Declaration

    Swift

    extension AuthApi: ReactiveCompatible
  • Declaration

    Swift

    extension Reactive where Base: AuthApi
    extension Reactive where Base: AuthController
  • Declaration

    Swift

    extension AuthController: ReactiveCompatible