Upgrade to Pro — share decks privately, control downloads, hide ads and more …

パフォーマンス改善とユニットテスト

shtnkgm
March 26, 2019

 パフォーマンス改善とユニットテスト

Bonfire iOS #5 発表資料

shtnkgm

March 26, 2019
Tweet

More Decks by shtnkgm

Other Decks in Programming

Transcript

  1. // Tips: ΞΫηεम০ࢠΛมߋ͢Δ // before @IBOutlet private weak var titleLabel:

    UILabel! // after @IBOutlet private(set) weak var titleLabel: UILabel!
  2. // Tips: subviews͔ΒಛఆΫϥεViewͷΈΛऔಘ͢Δ let labels = view.findViews(subclassOf: UILabel.self) let tabViews

    = view.findViews(subclassOf: TabView.self) extension UIView { var recursiveSubviews: [UIView] { return subviews + subviews.flatMap { $0.recursiveSubviews } } func findViews<T: UIView>(subclassOf: T.Type) -> [T] { return recursiveSubviews.compactMap { $0 as? T } } }
  3. // Tips: දࣔ׬ྃͷ଴ػ func waitUntil(condition: () -> Bool) { while

    !condition() { RunLoop.main.run(until: Date(timeIntervalSinceNow: 0.001)) } }