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
import Foundation | |
import MapKit | |
import Contacts | |
struct DummyData { | |
struct Location { | |
static let streetAddres = "269–299 Geary St" | |
static let city = "San Francisco" | |
static let subLocality = "Union Square" | |
static let state = "CA" |
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
int main(void) | |
{ | |
int h = get_positive_int("Height: "); // ask height and store it as i | |
printf("Stored: %i\n", h); //confirm value | |
for (int k = 1; k <= h; k++) | |
{ | |
for (int i = 1; i <= (h-k); i++) | |
{ | |
printf("."); |
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
int main(void) | |
{ | |
for (int i=0; i < 3; i++) | |
{ | |
for (int j=0; j<=i; j++) | |
{ | |
printf("#"); | |
} | |
printf("\n"); | |
} |
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
class SecondViewController: UIViewController { | |
private lazy var textField: UITextField = { | |
let txt = UITextField() | |
txt.returnKeyType = .done | |
txt.backgroundColor = .groupTableViewBackground | |
txt.layer.cornerRadius = 3.0 | |
txt.translatesAutoresizingMaskIntoConstraints = false | |
txt.delegate = self | |
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
class ViewController: UIViewController { | |
private let textLabel: UILabel = { | |
let label = UILabel() | |
label.translatesAutoresizingMaskIntoConstraints = false | |
label.textColor = .black | |
label.textAlignment = .center | |
label.numberOfLines = 0 | |
label.text = "My Label" | |
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
private let textLabel: UILabel = { | |
let label = UILabel() | |
label.textColor = .black | |
label.textAlignment = .center | |
label.numberOfLines = 0 | |
label.text = "My Label" | |
return label | |
}() | |
private var showButton: UIButton = { |
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
@objc private func showViewController(sender: UIButton) { | |
if let secondViewController = storyboard?.instantiateViewController(withIdentifier: “secondViewController”) as? SecondViewController { | |
present(secondViewController, animated: true, completion: nil) | |
} | |
} |
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
enum Animal: String { | |
case unknown | |
case dog | |
case cat | |
} | |
extension Optional where Wrapped == Animal { | |
var unwrappedOrUnknown: Animal { | |
switch self { |
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
struct MyObject { | |
var myProperty: String? | |
} | |
extension Optional where Wrapped == MyObject { | |
var unwrappedOrInit: MyObject { | |
switch self { | |
case .some(let unwrapped): | |
return unwrapped |
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
extension Optional where Wrapped == Bool { | |
var unwrappedOrFalse: Bool { | |
switch self { | |
case .some(let unwrapped): | |
return unwrapped | |
case .none: | |
return false | |
} | |
} |
NewerOlder