Skip to content
Open
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
58 changes: 58 additions & 0 deletions NoughtsAndCrosses/EmailValidatedTextField.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//
// EmailValidatedTextField.swift
// NoughtsAndCrosses
//
// Created by Ingrid Polk on 6/1/16.
// Copyright © 2016 Julian Hulme. All rights reserved.
//

import UIKit

class EmailValidatedTextField: UITextField, UITextFieldDelegate {

var imageView = UIImageView()

func valid() ->Bool {
print("Validating email: \(self.text)")
let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}"
let emailTest = NSPredicate(format:"SELF MATCHES %@", emailRegEx)
return emailTest.evaluateWithObject(self.text!)
}

func updateUI () {
if self.valid() {
imageView.image = UIImage(named: "input_valid")
} else {
imageView.image = UIImage(named: "input_invalid")
}
}

func validate() -> Bool{
self.updateUI()
return self.valid()
}

override func drawRect(rect: CGRect) {
imageView = UIImageView(frame: CGRectMake(self.frame.width-30, 5, 22, 22))
self.addSubview(imageView)
self.delegate = self
}

func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool {
if string != "" {
self.text?.append(Character(string))
} else {
self.text = self.text?.substringToIndex((self.text?.endIndex.predecessor())!)
}
updateUI()
return false
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func drawRect(rect: CGRect) {
// Drawing code
}
*/

}
198 changes: 193 additions & 5 deletions NoughtsAndCrosses/NoughtsAndCrosses.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
</Bucket>
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "42D447C91CD765670070326E"
BuildableName = "NoughtsAndCrosses.app"
BlueprintName = "NoughtsAndCrosses"
ReferencedContainer = "container:NoughtsAndCrosses.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "42D447DD1CD765680070326E"
BuildableName = "NoughtsAndCrossesTests.xctest"
BlueprintName = "NoughtsAndCrossesTests"
ReferencedContainer = "container:NoughtsAndCrosses.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "42D447E81CD765680070326E"
BuildableName = "NoughtsAndCrossesUITests.xctest"
BlueprintName = "NoughtsAndCrossesUITests"
ReferencedContainer = "container:NoughtsAndCrosses.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "42D447C91CD765670070326E"
BuildableName = "NoughtsAndCrosses.app"
BlueprintName = "NoughtsAndCrosses"
ReferencedContainer = "container:NoughtsAndCrosses.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "42D447C91CD765670070326E"
BuildableName = "NoughtsAndCrosses.app"
BlueprintName = "NoughtsAndCrosses"
ReferencedContainer = "container:NoughtsAndCrosses.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "42D447C91CD765670070326E"
BuildableName = "NoughtsAndCrosses.app"
BlueprintName = "NoughtsAndCrosses"
ReferencedContainer = "container:NoughtsAndCrosses.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?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>SchemeUserState</key>
<dict>
<key>NoughtsAndCrosses.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>42D447C91CD765670070326E</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>42D447DD1CD765680070326E</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>42D447E81CD765680070326E</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "0"
version = "2.0">
</Bucket>
38 changes: 34 additions & 4 deletions NoughtsAndCrosses/NoughtsAndCrosses/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,52 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?
var navigationController: UINavigationController?
var authorizationNavigationController = UINavigationController()
var loggedInNavigationController = UINavigationController()
var easterEggNavigationController = UINavigationController()

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.

let boardViewController = BoardViewController(nibName:"BoardViewController",bundle:nil)
self.navigationController = UINavigationController(rootViewController: boardViewController)
self.navigationController?.navigationBarHidden = true
// let boardViewController = BoardViewController(nibName:"BoardViewController",bundle:nil)
let loggedInViewController = BoardViewController(nibName: "BoardViewController", bundle: nil)
loggedInNavigationController = UINavigationController(rootViewController: loggedInViewController)

let landingViewController = LandingViewController(nibName: "LandingViewController", bundle: nil)
self.authorizationNavigationController = UINavigationController(rootViewController: landingViewController)
self.loggedInNavigationController.navigationBarHidden = true

self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
self.window?.rootViewController = self.navigationController
self.window?.makeKeyAndVisible()

let userIsLoggedIn = UserController.sharedInstance.getLoggedInUser()
if let loggedIn = userIsLoggedIn {
self.window?.rootViewController = self.loggedInNavigationController
} else {
self.window?.rootViewController = self.authorizationNavigationController
}

EasterEggController.sharedInstance.initiate(self.window!)


return true
}

func navigateToLoggedInNavigationController() {
self.window?.rootViewController = self.loggedInNavigationController
}

func navigateToLandingViewController(){
let landingViewController = LandingViewController(nibName: "LandingViewController", bundle: nil)
authorizationNavigationController = UINavigationController(rootViewController: landingViewController)
self.window?.rootViewController = self.authorizationNavigationController
}

func navigateToEasterEggScreen() {
let easterEggViewController = EasterEggViewController(nibName: "EasterEggViewController", bundle: nil)
easterEggNavigationController = UINavigationController(rootViewController: easterEggViewController)
self.window?.rootViewController = self.easterEggNavigationController
}

func applicationWillResignActive(application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "cross-S.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "cross-M.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "cross-L.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "tick-S.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "tick-M.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "tick-L.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
Expand Down
Loading