diff --git a/IfElse/IfElse.xcodeproj/project.xcworkspace/xcshareddata/IfElse.xccheckout b/IfElse/IfElse.xcodeproj/project.xcworkspace/xcshareddata/IfElse.xccheckout index c528788..6d80a9d 100644 --- a/IfElse/IfElse.xcodeproj/project.xcworkspace/xcshareddata/IfElse.xccheckout +++ b/IfElse/IfElse.xcodeproj/project.xcworkspace/xcshareddata/IfElse.xccheckout @@ -7,34 +7,34 @@ IDESourceControlProjectIdentifier 1FB1EB48-B010-423E-B8FC-A6EF94AD96F8 IDESourceControlProjectName - project + IfElse IDESourceControlProjectOriginsDictionary - 871AD5BEB35E842816B7B3CF4033C4298E764D23 - https://github.com/accesscode-2-2/unit-0.git + BAD0033D05756E529C5FF0EABC2DBC15B8B8219E + https://github.com/xhenna92/IfElse.git IDESourceControlProjectPath - lessons/week-0/IfElse/IfElse.xcodeproj/project.xcworkspace + IfElse/IfElse.xcodeproj IDESourceControlProjectRelativeInstallPathDictionary - 871AD5BEB35E842816B7B3CF4033C4298E764D23 - ../../../../.. + BAD0033D05756E529C5FF0EABC2DBC15B8B8219E + ../../.. IDESourceControlProjectURL - https://github.com/accesscode-2-2/unit-0.git + https://github.com/xhenna92/IfElse.git IDESourceControlProjectVersion 111 IDESourceControlProjectWCCIdentifier - 871AD5BEB35E842816B7B3CF4033C4298E764D23 + BAD0033D05756E529C5FF0EABC2DBC15B8B8219E IDESourceControlProjectWCConfigurations IDESourceControlRepositoryExtensionIdentifierKey public.vcs.git IDESourceControlWCCIdentifierKey - 871AD5BEB35E842816B7B3CF4033C4298E764D23 + BAD0033D05756E529C5FF0EABC2DBC15B8B8219E IDESourceControlWCCName - unit-0 + IfElse diff --git a/IfElse/IfElse.xcodeproj/project.xcworkspace/xcuserdata/Afsana.xcuserdatad/UserInterfaceState.xcuserstate b/IfElse/IfElse.xcodeproj/project.xcworkspace/xcuserdata/Afsana.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..acd599d Binary files /dev/null and b/IfElse/IfElse.xcodeproj/project.xcworkspace/xcuserdata/Afsana.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/IfElse/IfElse.xcodeproj/xcuserdata/Afsana.xcuserdatad/xcschemes/IfElse.xcscheme b/IfElse/IfElse.xcodeproj/xcuserdata/Afsana.xcuserdatad/xcschemes/IfElse.xcscheme new file mode 100644 index 0000000..6485954 --- /dev/null +++ b/IfElse/IfElse.xcodeproj/xcuserdata/Afsana.xcuserdatad/xcschemes/IfElse.xcscheme @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IfElse/IfElse.xcodeproj/xcuserdata/Afsana.xcuserdatad/xcschemes/xcschememanagement.plist b/IfElse/IfElse.xcodeproj/xcuserdata/Afsana.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..44aa48b --- /dev/null +++ b/IfElse/IfElse.xcodeproj/xcuserdata/Afsana.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + IfElse.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 8DFE63E81B22A54400D3D7AA + + primary + + + 8DFE64011B22A54400D3D7AA + + primary + + + + + diff --git a/IfElse/IfElse/Base.lproj/Main.storyboard b/IfElse/IfElse/Base.lproj/Main.storyboard index 34c014c..c726bf9 100644 --- a/IfElse/IfElse/Base.lproj/Main.storyboard +++ b/IfElse/IfElse/Base.lproj/Main.storyboard @@ -1,7 +1,8 @@ - + + @@ -17,104 +18,335 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IfElse/IfElse/ViewController.m b/IfElse/IfElse/ViewController.m index b3ee131..ceeb47c 100644 --- a/IfElse/IfElse/ViewController.m +++ b/IfElse/IfElse/ViewController.m @@ -9,19 +9,48 @@ #import "ViewController.h" @interface ViewController () +@property (weak, nonatomic) IBOutlet UITextField *cond1; +@property (weak, nonatomic) IBOutlet UITextField *cond2; +@property (weak, nonatomic) IBOutlet UITextField *cond3; +@property (weak, nonatomic) IBOutlet UILabel *outputLabel; @end @implementation ViewController -- (void)viewDidLoad { - [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. +- (IBAction)onSubmit:(id)sender { + NSString *name = self.cond1.text, + *email = self.cond2.text, + *emailVerify = self.cond3.text; + + + BOOL nameExists = [name length]; + BOOL emailsAreSame = [email isEqualToString:emailVerify]; + + BOOL isEmail = [email rangeOfString:@"^.+@.+\\..{2,}$" options:NSRegularExpressionSearch].location != NSNotFound; + BOOL isEmailV = [emailVerify rangeOfString:@"^.+@.+\\..{2,}$" options:NSRegularExpressionSearch].location != NSNotFound; + + if(nameExists){ + if (isEmail && isEmailV) { + + if(emailsAreSame){ + self.outputLabel.text = [NSString stringWithFormat:@"Welcome %@!", name]; + } + else { + self.outputLabel.text = [NSString stringWithFormat:@"Emails not the same"]; + } + } + else { + self.outputLabel.text = [NSString stringWithFormat:@"Please enter valid e-mail addresses"]; + } + } + else { + self.outputLabel.text = [NSString stringWithFormat:@"Please enter your name"]; + } + + + } -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} @end