diff --git a/README.md b/README.md index 300f43e..0675e7c 100644 --- a/README.md +++ b/README.md @@ -146,14 +146,16 @@ Additionally, You can choose whether to use callback pattern or delegation patte ```swift MisskeyKit.auth.appSecret = "Enter your Secret Key" -MisskeyKit.auth.viewController.resultApiKey() { apiKey in + +let authVC = MisskeyKit.auth.viewController +authVC.resultApiKey() { apiKey in guard let apiKey = apiKey else { return } print(apiKey) // u can get uesr's apikey. } -self.present(MisskeyKit.auth.viewController, animated: true) +self.present(authVC, animated: true) ``` @@ -164,9 +166,11 @@ class ViewController: UIViewController, AuthViewControllerDelegate { func something() { MisskeyKit.auth.appSecret = "Enter your Secret Key" - MisskeyKit.auth.viewController.delegate = self - self.present(MisskeyKit.auth.viewController, animated: true) + let authVC = MisskeyKit.auth.viewController + authVC.delegate = self + + self.present(authVC, animated: true) } //.... diff --git a/README_JP.md b/README_JP.md index adddffd..0f7532f 100644 --- a/README_JP.md +++ b/README_JP.md @@ -148,14 +148,16 @@ Misskeyのユーザー認証には本来、5つのステップが存在します ```swift MisskeyKit.auth.appSecret = "Enter your Secret Key" -MisskeyKit.auth.viewController.resultApiKey() { apiKey in + +let authVC = MisskeyKit.auth.viewController +authVC.resultApiKey() { apiKey in guard let apiKey = apiKey else { return } print(apiKey) // apiキーが取得できているのを確認できます } -self.present(MisskeyKit.auth.viewController, animated: true) +self.present(authVC, animated: true) ``` @@ -166,9 +168,11 @@ class ViewController: UIViewController, AuthViewControllerDelegate { func something() { MisskeyKit.auth.appSecret = "Enter your Secret Key" - MisskeyKit.auth.viewController.delegate = self - self.present(MisskeyKit.auth.viewController, animated: true) + let authVC = MisskeyKit.auth.viewController + authVC.delegate = self + + self.present(authVC, animated: true) } //....