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

iOS assignment 1B #7

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
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
10 changes: 10 additions & 0 deletions NoughtsAndCrosses.xcworkspace/contents.xcworkspacedata

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

30 changes: 30 additions & 0 deletions NoughtsAndCrosses/ClosureExperiment.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// ClosureExperiment.swift
// NoughtsAndCrosses
//
// Created by Rachel on 6/6/16.
// Copyright © 2016 Julian Hulme. All rights reserved.
//

import Foundation

class ClosureExperiment {



init () {
self.anotherFunction()
}

func thisIsAFunction(withAnInputVariable:String, withAClosure: () -> ()){
//print("thisIsAFunction is executing")
withAClosure()
}

func anotherFunction(){
//print("Another Function is executing")
}



}
60 changes: 60 additions & 0 deletions NoughtsAndCrosses/EmailValidatedTextField.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//
// EmailValidatedTextField.swift
// NoughtsAndCrosses
//
// Created by Rachel on 6/1/16.
// Copyright © 2016 Julian Hulme. All rights reserved.
//

import UIKit

class EmailValidatedTextField: UITextField, UITextFieldDelegate {
var imageView: UIImageView = UIImageView()
var message = ""


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

// Create a function called valid that takes no params, and returns a boolean. For now, always return true.
private func valid() -> Bool {
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(message)
}
// Create a function called updateUI that takes no params and returns no value. Leave the body blank for now.
func updateUI() {
if ( self.valid() ){
imageView.image = UIImage( named: "input_valid" )
}
else {
imageView.image = UIImage( named: "input_invalid")
}

}


func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool {
if ( string == "" ){
message.removeAtIndex(message.endIndex.predecessor())
}
message = message + string
updateUI()
return true
}



//Add a third function called validate that calls updateUI and returns the value of the valid function.
func validate() -> Bool {
self.updateUI()
return self.valid()
}




}
199 changes: 195 additions & 4 deletions NoughtsAndCrosses/NoughtsAndCrosses.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Binary file not shown.
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>
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 = "0720"
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>
Loading