Initial commit

This commit is contained in:
Drew Olbrich
2019-02-03 12:22:40 -08:00
commit 64e4ae6a9c
99 changed files with 17449 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
//
// AppDelegate.swift
// ManagerExample
//
// Created by Drew Olbrich on 1/10/19.
// Copyright 2019 Oath Inc.
//
// Licensed under the terms of the MIT License. See the file LICENSE for the full terms.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
return true
}
}
+47
View File
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
@@ -0,0 +1,98 @@
//
// SignUpViewController.swift
// ManagerExample
//
// Created by Drew Olbrich on 1/10/19.
// Copyright 2019 Oath Inc.
//
// Licensed under the terms of the MIT License. See the file LICENSE for the full terms.
//
import UIKit
import ScrollingContentViewController
/// A class that demonstrates using `ScrollingContentViewManager` in conjunction
/// with an arbitrary `UIViewController` class instead of subclassing
/// `ScrollingContentViewController`.
class SignUpViewController: UIViewController {
private lazy var scrollingContentViewManager = ScrollingContentViewManager(hostViewController: self)
/// Helper object that encapsulates code common to all
/// `ScrollingContentViewController` example applications.
private var signUpController: SignUpController?
@IBOutlet weak var contentView: UIView!
@IBOutlet weak var logoImageView: UIImageView!
@IBOutlet weak var nameTextField: PillTextField!
@IBOutlet weak var emailTextField: PillTextField!
@IBOutlet weak var passwordTextField: PillTextField!
@IBOutlet weak var signUpButton: PillButton!
@IBOutlet weak var signInButton: UIButton!
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
override func loadView() {
// Load all controls and connect all outlets defined by Interface Builder.
super.loadView()
scrollingContentViewManager.loadView(forContentView: contentView)
// Replace the root view with a gradient view.
view = GradientBackgroundView()
}
override func viewDidLoad() {
super.viewDidLoad()
// Set the content view's background color to transparent so the gradient
// background root view can be seen behind it.
contentView.backgroundColor = nil
// When ScrollingContentViewManager.contentView is first assigned, this has the
// side effect of adding a scroll view to the view controller's root view, and
// adding the content view to the scroll view. If a new view was assigned to this
// property later, it would replace the existing content view in the scroll view
// and leave the scroll view unchanged.
scrollingContentViewManager.contentView = contentView
// Allow the content view to shrink vertically when the keyboard is presented.
scrollingContentViewManager.shouldResizeContentViewForKeyboard = true
// Allow the user to dismiss the keyboard by dragging from the scroll view to the
// bottom of the screen.
scrollingContentViewManager.scrollView.keyboardDismissMode = .interactive
signUpController = SignUpController(logoImageView: logoImageView, nameTextField: nameTextField, emailTextField: emailTextField, passwordTextField: passwordTextField, signUpButton: signUpButton, signInButton: signInButton, delegate: self)
}
// Note: This is only required in apps that support device orientation changes.
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
scrollingContentViewManager.viewWillTransition(to: size, with: coordinator)
}
/// Note: This is only required in apps with navigation controllers that are used to
/// push sequences of view controllers with text fields that become the first
/// responder in `viewWillAppear`.
override func viewSafeAreaInsetsDidChange() {
super.viewSafeAreaInsetsDidChange()
scrollingContentViewManager.viewSafeAreaInsetsDidChange()
}
}
extension SignUpViewController: SignUpControllerDelegate {
func signUpControllerScrollFirstResponderToVisible(_ signUpController: SignUpController) {
scrollingContentViewManager.scrollView.scrollFirstResponderToVisible(animated: true)
}
}