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
| extension Color { | |
| /// Create colour with integer RGB values | |
| /// - Parameters: | |
| /// - colorSpace: Color space | |
| /// - red: Red colour value from 0 to 255, inclusive | |
| /// - green: Green colour value from 0 to 255, inclusive | |
| /// - blue: Blue colour value from 0 to 255, inclusive | |
| /// - opacity: Opacity from 0 to 1 | |
| init(_ colorSpace: Color.RGBColorSpace = .sRGB, |
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
| // XCode 13.4.1 | |
| // Swift 5.6.1 | |
| import UIKit | |
| import PlaygroundSupport | |
| class testViewController: UIViewController { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| self.view.frame = CGRect(x: 0, y: 0, width: 375, height: 812) |
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
| // Define text attributes and create a fancy title | |
| let fancyTitleAttrs: [NSAttributedString.Key: Any] = [ | |
| .font: UIFont.systemFont(ofSize: 18, weight: .bold), | |
| .foregroundColor: UIColor.red | |
| ] | |
| let errorTitle = NSAttributedString(string: "Error!!", | |
| attributes: fancyTitleAttrs) | |
| // Create an alert controller - without title. | |
| let alert = UIAlertController(title: "Error", |
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
| // XCode 13.4.1 | |
| // Swift 5.6.1 | |
| import UIKit | |
| import PlaygroundSupport | |
| class testViewController: UIViewController { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| self.view.frame = CGRect(x: 0, y: 0, width: 375, height: 812) |
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
| // XCode 13.4.1 | |
| // Swift 5.6.1 | |
| import UIKit | |
| import PlaygroundSupport | |
| class testViewController: UIViewController { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| self.view.frame = CGRect(x: 0, y: 0, width: 375, height: 812) |
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
| // XCode 13.4.1 | |
| // Swift 5.6.1 | |
| import UIKit | |
| import PlaygroundSupport | |
| class testViewController: UIViewController { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| self.view.frame = CGRect(x: 0, y: 0, width: 375, height: 812) |
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
| // XCode 13.4.1 | |
| // Swift 5.6.1 | |
| class testViewController: UIViewController { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| self.view.frame = CGRect(x: 0, y: 0, width: 375, height: 812) | |
| self.view.backgroundColor = .white | |
| } | |
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
| import UIKit | |
| // Define text attributes | |
| let fancyTitleAttrs: [NSAttributedString.Key: Any] = [ | |
| .font: UIFont.systemFont(ofSize: 18, weight: .bold), | |
| .foregroundColor: UIColor.red | |
| ] | |
| let errorTitle = NSAttributedString(string: "Error", attributes: fancyTitleAttrs) |
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: "Error", | |
| message: "Invalid credential", | |
| preferredStyle: .alert) | |
| alert.addAction(UIAlertAction(title: "OK", | |
| style: .default, | |
| handler: { action in | |
| // Do something | |
| })) |