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
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,34 @@
<key>IDESourceControlProjectIdentifier</key>
<string>1FB1EB48-B010-423E-B8FC-A6EF94AD96F8</string>
<key>IDESourceControlProjectName</key>
<string>project</string>
<string>IfElse</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>871AD5BEB35E842816B7B3CF4033C4298E764D23</key>
<string>https://github.com/accesscode-2-2/unit-0.git</string>
<key>BAD0033D05756E529C5FF0EABC2DBC15B8B8219E</key>
<string>https://github.com/JovannyEspinal/IfElse.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>lessons/week-0/IfElse/IfElse.xcodeproj/project.xcworkspace</string>
<string>IfElse/IfElse.xcodeproj</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>871AD5BEB35E842816B7B3CF4033C4298E764D23</key>
<string>../../../../..</string>
<key>BAD0033D05756E529C5FF0EABC2DBC15B8B8219E</key>
<string>../../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>https://github.com/accesscode-2-2/unit-0.git</string>
<string>https://github.com/JovannyEspinal/IfElse.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>111</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>871AD5BEB35E842816B7B3CF4033C4298E764D23</string>
<string>BAD0033D05756E529C5FF0EABC2DBC15B8B8219E</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>871AD5BEB35E842816B7B3CF4033C4298E764D23</string>
<string>BAD0033D05756E529C5FF0EABC2DBC15B8B8219E</string>
<key>IDESourceControlWCCName</key>
<string>unit-0</string>
<string>IfElse</string>
</dict>
</array>
</dict>
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0630"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DFE63E81B22A54400D3D7AA"
BuildableName = "IfElse.app"
BlueprintName = "IfElse"
ReferencedContainer = "container:IfElse.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DFE64011B22A54400D3D7AA"
BuildableName = "IfElseTests.xctest"
BlueprintName = "IfElseTests"
ReferencedContainer = "container:IfElse.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DFE64011B22A54400D3D7AA"
BuildableName = "IfElseTests.xctest"
BlueprintName = "IfElseTests"
ReferencedContainer = "container:IfElse.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DFE63E81B22A54400D3D7AA"
BuildableName = "IfElse.app"
BlueprintName = "IfElse"
ReferencedContainer = "container:IfElse.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DFE63E81B22A54400D3D7AA"
BuildableName = "IfElse.app"
BlueprintName = "IfElse"
ReferencedContainer = "container:IfElse.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DFE63E81B22A54400D3D7AA"
BuildableName = "IfElse.app"
BlueprintName = "IfElse"
ReferencedContainer = "container:IfElse.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,27 @@
<?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>IfElse.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>8DFE63E81B22A54400D3D7AA</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>8DFE64011B22A54400D3D7AA</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
47 changes: 28 additions & 19 deletions IfElse/IfElse/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="vXZ-lx-hvc">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
<capability name="Alignment constraints with different attributes" minToolsVersion="5.1"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -35,18 +36,21 @@
<include reference="Zqi-Kp-0sb"/>
</mask>
</variation>
<connections>
<action selector="Button:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="Lke-jE-eCq"/>
</connections>
</button>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="iGu-Ut-VER">
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Name" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="iGu-Ut-VER">
<rect key="frame" x="0.0" y="-30" width="97" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="NHM-gg-8tT">
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Age" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="aB7-bV-Euy">
<rect key="frame" x="0.0" y="-30" width="97" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="aB7-bV-Euy">
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Gender (M or F)" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="NHM-gg-8tT">
<rect key="frame" x="0.0" y="-30" width="97" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
Expand All @@ -71,47 +75,52 @@
<mask key="subviews">
<exclude reference="z7z-6R-wIs"/>
<exclude reference="iGu-Ut-VER"/>
<exclude reference="NHM-gg-8tT"/>
<exclude reference="aB7-bV-Euy"/>
<exclude reference="NHM-gg-8tT"/>
</mask>
<mask key="constraints">
<exclude reference="8TF-Rc-kG4"/>
<exclude reference="YG0-rg-2K5"/>
<exclude reference="y9A-GV-8wG"/>
<exclude reference="FUk-zx-HHm"/>
<exclude reference="NaR-3r-PFr"/>
<exclude reference="pIc-Dd-VL9"/>
<exclude reference="u61-Ws-DaA"/>
<exclude reference="4m5-pb-omc"/>
<exclude reference="KoG-0I-h8P"/>
<exclude reference="vUU-ID-K6d"/>
<exclude reference="FUk-zx-HHm"/>
<exclude reference="NaR-3r-PFr"/>
<exclude reference="pIc-Dd-VL9"/>
<exclude reference="8TF-Rc-kG4"/>
<exclude reference="YG0-rg-2K5"/>
<exclude reference="y9A-GV-8wG"/>
<exclude reference="dAR-uW-kvy"/>
<exclude reference="rJf-e4-gKp"/>
<exclude reference="u61-Ws-DaA"/>
</mask>
</variation>
<variation key="widthClass=compact">
<mask key="subviews">
<include reference="z7z-6R-wIs"/>
<include reference="iGu-Ut-VER"/>
<include reference="NHM-gg-8tT"/>
<include reference="aB7-bV-Euy"/>
<include reference="NHM-gg-8tT"/>
</mask>
<mask key="constraints">
<include reference="8TF-Rc-kG4"/>
<include reference="YG0-rg-2K5"/>
<include reference="y9A-GV-8wG"/>
<include reference="FUk-zx-HHm"/>
<include reference="NaR-3r-PFr"/>
<include reference="pIc-Dd-VL9"/>
<include reference="u61-Ws-DaA"/>
<include reference="4m5-pb-omc"/>
<include reference="KoG-0I-h8P"/>
<include reference="vUU-ID-K6d"/>
<include reference="FUk-zx-HHm"/>
<include reference="NaR-3r-PFr"/>
<include reference="pIc-Dd-VL9"/>
<include reference="8TF-Rc-kG4"/>
<include reference="YG0-rg-2K5"/>
<include reference="y9A-GV-8wG"/>
<include reference="dAR-uW-kvy"/>
<include reference="rJf-e4-gKp"/>
<include reference="u61-Ws-DaA"/>
</mask>
</variation>
</view>
<connections>
<outlet property="Age" destination="aB7-bV-Euy" id="Nrg-tJ-DMY"/>
<outlet property="Gender" destination="NHM-gg-8tT" id="2hT-ol-Vbe"/>
<outlet property="Name" destination="iGu-Ut-VER" id="tbZ-vO-eoR"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
Expand Down
44 changes: 36 additions & 8 deletions IfElse/IfElse/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,47 @@
#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextField *Name;
@property (weak, nonatomic) IBOutlet UITextField *Age;
@property (weak, nonatomic) IBOutlet UITextField *Gender;

@end

@implementation ViewController

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
- (IBAction)Button:(id)sender {

NSString *age = self.Age.text;
NSString *name = self.Name.text;
NSString *gender = self.Gender.text;
NSInteger ageValue = [age integerValue];

BOOL sameName = [name isEqualToString:@"Jovanny"] || [name isEqualToString:@"jovanny"];
BOOL male = [gender isEqualToString:@"m"] || [gender isEqualToString:@"M"];
BOOL adult = ageValue >= 21;

if (sameName) {
NSLog(@"Wow, so cool. We have the same name!");
if (!male) {
NSLog(@"Never heard of a girl with my name before.");
}
else {
NSLog(@"We are totally bros!");
}

}
else {
NSLog(@"Wow, what a cool name. Nice to meet you, %@. I'm Jovanny.", name);
if (adult) {
NSLog(@"We should defintiely grab a drink sometime. SHOTS! SHOTS! SHOTS!");
}
else {
NSLog(@"We should definitely play some video games sometime.");
}
}


}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}


@end