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

Added implementation of button and text fields #1

Open
wants to merge 3 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
Binary file added IfElse/.DS_Store
Binary file not shown.
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/mesbekmek/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/mesbekmek/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>
80 changes: 66 additions & 14 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,6 +36,9 @@
<include reference="Zqi-Kp-0sb"/>
</mask>
</variation>
<connections>
<action selector="buttonTapped:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="w8S-b1-YfY"/>
</connections>
</button>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="iGu-Ut-VER">
<rect key="frame" x="0.0" y="-30" width="97" height="30"/>
Expand All @@ -51,6 +55,37 @@
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="bzx-t6-LyK">
<rect key="frame" x="-25" y="-15" width="51" height="31"/>
<variation key="widthClass=compact" fixedFrame="YES">
<rect key="frame" x="42" y="199" width="51" height="31"/>
</variation>
</switch>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="GqV-Gl-Qp1">
<rect key="frame" x="-10" y="-10" width="20" height="20"/>
<variation key="widthClass=compact" fixedFrame="YES">
<rect key="frame" x="171" y="210" width="20" height="20"/>
</variation>
</activityIndicatorView>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gft-hs-Is2">
<rect key="frame" x="0.0" y="0.0" width="240" height="128"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
<variation key="widthClass=compact" fixedFrame="YES">
<rect key="frame" x="24" y="236" width="190" height="91"/>
</variation>
</textView>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3n6-jp-XHb">
<rect key="frame" x="0.0" y="0.0" width="240" height="128"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
<variation key="widthClass=compact" fixedFrame="YES">
<rect key="frame" x="24" y="238" width="190" height="91"/>
</variation>
</textView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
Expand All @@ -73,20 +108,24 @@
<exclude reference="iGu-Ut-VER"/>
<exclude reference="NHM-gg-8tT"/>
<exclude reference="aB7-bV-Euy"/>
<exclude reference="bzx-t6-LyK"/>
<exclude reference="GqV-Gl-Qp1"/>
<exclude reference="gft-hs-Is2"/>
<exclude reference="3n6-jp-XHb"/>
</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">
Expand All @@ -95,26 +134,39 @@
<include reference="iGu-Ut-VER"/>
<include reference="NHM-gg-8tT"/>
<include reference="aB7-bV-Euy"/>
<include reference="bzx-t6-LyK"/>
<include reference="GqV-Gl-Qp1"/>
<include reference="gft-hs-Is2"/>
<include reference="3n6-jp-XHb"/>
</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="activityIndicator" destination="GqV-Gl-Qp1" id="iIM-NM-uKE"/>
<outlet property="textField1" destination="iGu-Ut-VER" id="w2P-OX-tzY"/>
<outlet property="textField2" destination="aB7-bV-Euy" id="qcn-vH-9tW"/>
<outlet property="textField3" destination="NHM-gg-8tT" id="kOB-3i-xZf"/>
<outlet property="textView1" destination="3n6-jp-XHb" id="eHH-iP-DzG"/>
<outlet property="toggle" destination="bzx-t6-LyK" id="PTY-Tl-8eU"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="139.5" y="314"/>
</scene>
</scenes>
</document>
55 changes: 48 additions & 7 deletions IfElse/IfElse/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,59 @@

@interface ViewController ()

@property (weak, nonatomic) IBOutlet UITextField *textField1;
@property (weak, nonatomic) IBOutlet UITextField *textField2;
@property (weak, nonatomic) IBOutlet UITextField *textField3;
@property (weak, nonatomic) IBOutlet UISwitch *toggle;

@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *activityIndicator;
@property (weak, nonatomic) IBOutlet UITextView *textView1;

@end

@implementation ViewController

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

NSString *one = self.textField1.text;
NSString *two = self.textField2.text;
NSString *three = self.textField3.text;

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
BOOL oneEqualsTwo = [one isEqualToString:two];

if(oneEqualsTwo){
// NSLog(@"First two are equal");
[self.toggle setOn:YES animated:YES];
}else{
[self.toggle setOn:NO animated:YES];
}


NSInteger intFromString1 = [one integerValue];
NSInteger intFromString2 = [two integerValue];

BOOL integersAreEqual = intFromString1==intFromString2;

NSInteger integer1Length = [one length];
NSInteger integer2Length = [two length];


BOOL integersLengthAreEqual = integer1Length==integer2Length;

if(integersAreEqual&&integersLengthAreEqual){
self.textView1.text = @"You extracted integers from the string bruh!";
[self.toggle setOn:YES animated:YES];
[self.activityIndicator startAnimating];
}else{
self.textView1.text = @"Not cool bro!";
[self.toggle setOn:NO animated:YES];
[self.activityIndicator stopAnimating];
}


NSLog(@"%@",one);
}


@end