This file contains hidden or 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
| let a = 1 | |
| let str = "hello" | |
| print("์๋ฃํ : ",type(of:a)) | |
| print("์๋ฃํ : ",type(of:str)) | |
| //๊ฒฐ๊ณผ | |
| //์๋ฃํ Int | |
| //์๋ฃํ String |
This file contains hidden or 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
| let str : String = "์ธ๊ธฐ์" | |
| print("๋ณํ : ", str.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)) | |
| //๊ฒฐ๊ณผ | |
| ๋ณํ : %EC%9D%B8%EA%B8%B0%EC%88%9C | |
| ์ฌ์ฉ์์ get์ value ๊ฐ์ด db์์ ํ๊ธ๊ณผ ์ผ์นํ๋ค๋ฉด | |
| https:/localhost.com?keyword=%EC%9D%B8%EA%B8%B0%EC%88%9 // %EC%9D%B8%EA%B8%B0%EC%88%9 <- ์ธ๊ธฐ์ |
This file contains hidden or 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
| button.translatesAutoresizingMaskIntoConstraints = false | |
| button.setTitle("๋๋ณด๊ธฐ", for: .normal) //title๋ฃ๊ธฐ | |
| button.setImage(#imageLiteral(resourceName: "arrow_left_48px"), for: .normal)// ์ด๋ฏธ์ง ๋ฃ๊ธฐ | |
| button.setTitleColor(.black, for: .normal) | |
| button.imageView?.contentMode = .scaleAspectFit | |
| button.titleLabel?.font = .boldSystemFont(ofSize: 12) | |
| button.contentHorizontalAlignment = .center | |
| button.semanticContentAttribute = .forceRightToLeft //<- ์ค์ | |
This file contains hidden or 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
| Usage: | |
| var color1 = hexStringToUIColor("#d3d3d3") | |
| Swift 5: (Swift 4+) | |
| func hexStringToUIColor (hex:String) -> UIColor { | |
| var cString:String = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased() | |
| if (cString.hasPrefix("#")) { | |
| cString.remove(at: cString.startIndex) |
This file contains hidden or 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
| let search_textField : UITextField = | |
| { | |
| let textfield = UITextField() | |
| textfield.translatesAutoresizingMaskIntoConstraints = false | |
| textfield.placeholder = "๋ด์ฉ์ ์ ๋ ฅํด์ฃผ์ธ์." | |
| //ํ ๋๋ฆฌ์ ์์ | |
| textfield.layer.cornerRadius = 2 | |
| textfield.layer.borderWidth = 2 | |
| textfield.layer.borderColor = UIColor.gray.cgColor.copy(alpha: 0.8) |
This file contains hidden or 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
| let alert = UIAlertController(title: "์๋ฆผ", message: "๋ ๋ฆฌ๋ง~~~~", preferredStyle: UIAlertController.Style.alert) | |
| let okAction = UIAlertAction(title: "OK", style: .default) { (action) in | |
| //OK ๋ฒํผ ๋๋ฅธ๋ค ์ํํ ์ฝ๋ | |
| } | |
| alert.addAction(okAction) |
This file contains hidden or 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
| let alert = UIAlertController(title: "์๋ฆผ", message: "๋ ๋ฆฌ๋ง~~~~", preferredStyle: UIAlertController.Style.alert) | |
| let okAction = UIAlertAction(title: "OK", style: .default) { (action) in | |
| //OK ๋ฒํผ ๋๋ฅธ๋ค ์ํํ ์ฝ๋ | |
| } | |
| alert.addAction(okAction) |
This file contains hidden or 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
| func validpassword(mypassword : String) -> Bool | |
| {//์ซ์+๋ฌธ์ ํฌํจํด์ 8~20๊ธ์ ์ฌ์ด์ text ์ฒดํฌํ๋ ์ ๊ทํํ์ | |
| let passwordreg = ("(?=.*[A-Za-z])(?=.*[0-9]).{8,20}") | |
| let passwordtesting = NSPredicate(format: "SELF MATCHES %@", passwordreg) | |
| return passwordtesting.evaluate(with: mypassword) | |
| } |
This file contains hidden or 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
| let textField = UITextField() | |
| textField.textContentType = .newPassword | |
| textField.isSecureTextEntry = true | |
| ์์๊ฐ์ด ์ ๋ ฅํ๋ฉด ์ผ๋ฐ์ ์ผ๋ก ์ฑ ์ฌ์ฉํ ๋ ํจ์ค์๋ ์ ๋ ฅํ๋ฏ์ด | |
| ๊ธ์๋ฅผ ์ ๋ ฅํ๋ฉด ๋๊ทธ๋ผ๋ฏธ๋ก ํํ๋ฉ๋๋ค. |
This file contains hidden or 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
| mport UIKit | |
| //๋ฐ์ดํฐ ์ ์ก์ ์ํด ํ๋กํ ์ฝ์ ์ ์ธํ๋ค. | |
| protocol PassData | |
| { | |
| func passdata(data : String) | |
| } | |
| // 1. B->A๋ก ๋ฐ์ดํฐ๋ฅผ ์ ์กํ๊ธฐ ์ํด์ ํ๋กํ ์ฝ์ ์ ์ธํ๊ณ ๊ทธ์์ ๋ฉ์๋๋ฅผ ๋ง๋ ๋ค. | |
| class page2: UIViewController { |