私はSignInViewController.swiftでクラスを持っている:別々のクラスからAppDelegateに値を渡すには?
class CredentialState: NSObject {
static let sharedInstance = CredentialState()
var signedIn = false
var displayName: String?
var photoUrl: NSURL?
}
私はのif-else文でAppDelegateでユーザーを認証するために、変数signedInを使用したいと思います。現在、私はCustomTabBarController(プログラムで作成されたカスタム)にviewcontrollerを設定する方法がありますまたは SignInViewController(ストーリーボード製)。 ifステートメントは、値がfalseの場合、コントローラをサインイン画面に設定し、それが真であればタブバー画面に進みます。
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
FIRApp.configure()
// Override point for customization after application launch.
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.makeKeyAndVisible()
// Main view controller is inside of customtabbarcontroller, which gives a tab overlay
// window?.rootViewController = CustomTabBarController()
// Sets the main view to a storyboard element, such as SignInVC
let storyboard = UIStoryboard(name: "SignIn", bundle: nil)
let loginVC = storyboard.instantiateViewControllerWithIdentifier("SignInVC") as! SignInViewController
self.window?.rootViewController = loginVC
return true
}
に答えることができました
希望。ありがとう! – About7Deaths
ようこそ。お役に立てて嬉しいです :) –