http://www.bredemeyer.com/links.htm
http://perfwork.wordpress.com/
http://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html
http://en.wikipedia.org/wiki/4%2B1_architectural_view_model
http://epf.eclipse.org/wikis/openup/core.tech.common.extend_supp/guidances/examples/four_plus_one_view_of_arch_9A93ACE5.html
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 UIKit | |
class ListViewController: UIViewController { | |
let label = UILabel(frame: CGRect(x: 100, y: 200, width: 300, height: 50)) | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
view.backgroundColor = .white | |
label.text = "Animating" |
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 UIKit | |
class ListViewController: UIViewController { | |
var listTitle: (() -> String)? | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
listTitle = makeTitle | |
} |
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 UIKit | |
class ListViewController: UIViewController { | |
var listTitle: (() -> String)? | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
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 UIKit | |
class ListViewController: UIViewController { | |
var listTitle: (() -> String)? | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
listTitle = { | |
print(self.view.debugDescription) |
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
func countLines(of label: UILabel, maxHeight: CGFloat) -> Int { | |
// viewDidLayoutSubviews() in ViewController or layoutIfNeeded() in view subclass | |
guard let labelText = label.text else { | |
return 0 | |
} | |
let rect = CGSize(width: label.bounds.width, height: maxHeight) | |
let labelSize = labelText.boundingRect(with: rect, options: .usesLineFragmentOrigin, attributes: [NSAttributedString.Key.font: label.font!], context: nil) | |
let lines = Int(ceil(CGFloat(labelSize.height) / label.font.lineHeight)) |
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
func countLines(of label: UILabel, maxHeight: CGFloat) -> Int { | |
// viewDidLayoutSubviews() in ViewController or layoutIfNeeded() in view subclass | |
guard let labelText = label.text else { | |
return 0 | |
} | |
let rect = CGSize(width: label.bounds.width, height: maxHeight) | |
let labelSize = labelText.boundingRect(with: rect, options: .usesLineFragmentOrigin, attributes: [NSAttributedString.Key.font: label.font!], context: nil) | |
return Int(ceil(CGFloat(labelSize.height) / label.font.lineHeight)) |
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
final class ViewController: UIViewController { | |
let containerView = UIView() | |
let tableView = UITableView() | |
var dataModel: [String] = ["Jan", "Feb", "March"] { | |
didSet { | |
if (dataModel != oldValue) { | |
tableView.reloadData() | |
} | |
} | |
willSet(newValue) { |
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 | |
struct Rectangle { | |
var width = 0.0 | |
var height = 0.0 | |
var area: Double { | |
set { | |
width = sqrt(newValue) | |
height = sqrt(newValue) |
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 User { | |
let name: String | |
let identifier: String | |
} | |
final class UserTransaction { | |
private let dataBase: DataBase | |
init(dataBase: DataBase) { | |
self.dataBase = dataBase |