Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3: Add view controller instantiation #39

Merged
merged 8 commits into from Sep 23, 2019

Conversation

initFabian
Copy link
Collaborator

How to Test:

Test .homeViewController

  • go into AppDelegate.swift for the Cely Demo target
  • set the following option:
.homeStoryboard: UIStoryboard(name: "Main", bundle: nil)
  • run application
  • VERIFY: deprecation warning appears with Fix button
  • Replace option with:
.homeViewController: UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "SecondViewController")
  • run application
  • VERIFY: application builds
  • put in the credentials:
    • username: asdf
    • password: asdf
  • VERIFY: you are brought to the set view controller

Test .loginViewController

  • set the following option:
.loginStoryboard: UIStoryboard(name: "TestStoryboard", bundle: nil)
  • run application
  • VERIFY: deprecation warning appears with Fix button
  • Replace option with:
.loginStoryboard: UIStoryboard(name: "TestStoryboard", bundle: nil).instantiateInitialViewController()
  • run application
  • VERIFY: a different login view controller is displayed. the elements aren't connected to anything so the login feature wont work.

Fabian Buentello added 5 commits August 8, 2019 00:40
…th .appEntryViewController and .loginViewController
…th .appEntryViewController and .loginViewController
…m/initFabian/Cely into add-view-controller-instantiation

# Conflicts:
#	Cely Demo/AppDelegate.swift
#	Sources/CelyConstants.swift
#	Sources/CelyWindowManager.swift
#	Tests/CelyWindowManagerTest.swift
@initFabian initFabian changed the base branch from v3/master to master September 2, 2019 17:00
@initFabian
Copy link
Collaborator Author

@alextall - btw, this adds support for SwiftUI as well. Im doing some work in the documentation Repo to add it.

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
  if let windowScene = scene as? UIWindowScene {
      let window = UIWindow(windowScene: windowScene)
//        window.rootViewController = UIHostingController(rootView: ContentView())
      self.window = window
      window.makeKeyAndVisible()
      Cely.setup(with: window, forModel: User(), requiredProperties: [.token], withOptions: [
        .homeViewController: UIHostingController(rootView: HomeContentView()),
        .loginCompletionBlock: { (username: String, password: String) in
            if username == "asdf" && password == "asdf" {
                Cely.save(username, forKey: "username")
                Cely.save("FAKETOKEN:\(username)\(password)", forKey: "token", securely: true)
                Cely.changeStatus(to: .loggedIn)
            }
        }
      ])
  }
}

@initFabian
Copy link
Collaborator Author

After this PR we'll add swift-format 😑

@initFabian initFabian merged commit bf85335 into master Sep 23, 2019
@initFabian initFabian deleted the add-view-controller-instantiation branch September 23, 2019 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants