Skip to content

Instantly share code, notes, and snippets.

@yakout
Created July 27, 2016 11:59
Show Gist options
  • Save yakout/697a6eacb7c703ea8a48eb2e9f7bb4dd to your computer and use it in GitHub Desktop.
Save yakout/697a6eacb7c703ea8a48eb2e9f7bb4dd to your computer and use it in GitHub Desktop.
//
// 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
}
}
//
// 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