Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions samples/swift/uidemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
574F1B131D8106D2001924BB /* UIStoryboardExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 574F1B121D8106D2001924BB /* UIStoryboardExtension.swift */; };
8D16073E1D492B200069E4F5 /* AuthViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D16073D1D492B200069E4F5 /* AuthViewController.swift */; };
8DABC9891D3D82D600453807 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DABC9881D3D82D600453807 /* AppDelegate.swift */; };
8DABC98B1D3D82D600453807 /* MenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DABC98A1D3D82D600453807 /* MenuViewController.swift */; };
Expand All @@ -31,6 +32,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
574F1B121D8106D2001924BB /* UIStoryboardExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIStoryboardExtension.swift; sourceTree = "<group>"; };
8D16073D1D492B200069E4F5 /* AuthViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthViewController.swift; sourceTree = "<group>"; };
8DABC9851D3D82D600453807 /* uidemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = uidemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
8DABC9881D3D82D600453807 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -100,6 +102,7 @@
8DABC98A1D3D82D600453807 /* MenuViewController.swift */,
8DABC9AA1D3D947300453807 /* SampleCell.swift */,
8DABC9A81D3D872C00453807 /* Sample.swift */,
574F1B121D8106D2001924BB /* UIStoryboardExtension.swift */,
8DD17C951D4BCC6500E850E4 /* AuthSample */,
8D643F0F1D4827F10081F979 /* ChatSample */,
8DABC98C1D3D82D600453807 /* Main.storyboard */,
Expand Down Expand Up @@ -329,6 +332,7 @@
files = (
8DABC98B1D3D82D600453807 /* MenuViewController.swift in Sources */,
8DABC9AB1D3D947300453807 /* SampleCell.swift in Sources */,
574F1B131D8106D2001924BB /* UIStoryboardExtension.swift in Sources */,
8DABC9A91D3D872C00453807 /* Sample.swift in Sources */,
8D16073E1D492B200069E4F5 /* AuthViewController.swift in Sources */,
8DABC9AD1D3D9EAF00453807 /* ChatViewController.swift in Sources */,
Expand Down
6 changes: 1 addition & 5 deletions samples/swift/uidemo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@

import UIKit
import Firebase
import FirebaseAuthUI.FIRAuthUI
import FirebaseAuthUI

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

static var mainStoryboard: UIStoryboard {
return UIStoryboard(name: "Main", bundle: nil)
}

var window: UIWindow?

Expand Down
5 changes: 1 addition & 4 deletions samples/swift/uidemo/AuthViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,5 @@ class AuthViewController: UIViewController {
override func viewWillLayoutSubviews() {
self.topConstraint.constant = self.topLayoutGuide.length
}

static func fromStoryboard(storyboard: UIStoryboard = AppDelegate.mainStoryboard) -> AuthViewController {
return storyboard.instantiateViewControllerWithIdentifier("AuthViewController") as! AuthViewController
}

}
8 changes: 1 addition & 7 deletions samples/swift/uidemo/ChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,7 @@ class ChatViewController: UIViewController, UICollectionViewDelegateFlowLayout {

self.textView.text = ""
}

// MARK: - Boilerplate

static func fromStoryboard(storyboard: UIStoryboard = AppDelegate.mainStoryboard) -> ChatViewController {
return storyboard.instantiateViewControllerWithIdentifier("ChatViewController") as! ChatViewController
}


override func viewDidLoad() {
super.viewDidLoad()

Expand Down
4 changes: 2 additions & 2 deletions samples/swift/uidemo/Sample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ enum Sample: Int, RawRepresentable {
func controller() -> UIViewController {
switch self {
case .Chat:
return ChatViewController.fromStoryboard()
return UIStoryboard.instantiateViewController("Main", identifier: "ChatViewController") as! ChatViewController
case .Auth:
return AuthViewController.fromStoryboard()
return UIStoryboard.instantiateViewController("Main", identifier: "AuthViewController") as! AuthViewController
}
}
}
23 changes: 23 additions & 0 deletions samples/swift/uidemo/UIStoryboardExtension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// Copyright (c) 2016 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import UIKit

extension UIStoryboard {
static func instantiateViewController(storyboard: String, identifier: String) -> UIViewController {
return UIStoryboard(name: storyboard, bundle: nil).instantiateViewControllerWithIdentifier(identifier)
}
}