Created
July 27, 2016 11:59
-
-
Save yakout/697a6eacb7c703ea8a48eb2e9f7bb4dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// User.swift | |
// calculator | |
// | |
// Created by Ahmed Yakout on 7/26/16. | |
// Copyright © 2016 iYakout. All rights reserved. | |
// | |
import Foundation // arrays list ... | |
class User { | |
var email: String | |
var pass: String | |
func auth() -> Bool { | |
let sataticEmail = "[email protected]" | |
let staticPass = "123456789" | |
var flag = false | |
if self.pass == staticPass && self.email == sataticEmail { | |
flag = true | |
} | |
return flag | |
} | |
init(_ email: String, _ pass: String) { | |
self.email = email | |
self.pass = pass | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// calculator | |
// | |
// Created by Ahmed Yakout on 7/26/16. | |
// Copyright © 2016 iYakout. All rights reserved. | |
// | |
import UIKit | |
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. | |
} | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
// Dispose of any resources that can be recreated. | |
} | |
@IBOutlet weak var email: UITextField! | |
@IBOutlet weak var pass: UITextField! | |
@IBAction func login(sender: UIButton) { | |
if let temp = email.text, let temp2 = pass.text { | |
let user = User(temp, temp2) | |
if user.auth() { | |
print("email: \(temp)\npass: \(temp2)") | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment