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

Add dark mode to your apps in iOS 13 #wwdc19 #t...

fromkk
June 18, 2019

Add dark mode to your apps in iOS 13 #wwdc19 #timers_meetup

Timersで開催されたTimers Meetup #2 WWDC After Partyで発表した内容です。
Dark Modeに対応する為に必要な知識を発表しました。

fromkk

June 18, 2019
Tweet

More Decks by fromkk

Other Decks in Programming

Transcript

  1. 1SPpMF struct Profile { let name = "Kazuya Ueoka" let

    twitter = "@fromkk" let github = "fromkk" let qiita = "fromkk" let company = "Timers Inc." } • 2
  2. 04͕༻ҙͨ͠৭Λར༻ open class var systemIndigo: UIColor { get }
 open

    class var systemGray2: UIColor { get }
 open class var systemGray3: UIColor { get }
 open class var systemGray4: UIColor { get }
 open class var systemGray5: UIColor { get }
 open class var systemGray6: UIColor { get }
 open class var label: UIColor { get }
 open class var secondaryLabel: UIColor { get }
 open class var tertiaryLabel: UIColor { get }
 open class var quaternaryLabel: UIColor { get }
 open class var link: UIColor { get }
 open class var placeholderText: UIColor { get }
 open class var separator: UIColor { get }
 open class var opaqueSeparator: UIColor { get }
 open class var systemBackground: UIColor { get }
 open class var secondarySystemBackground: UIColor { get }
 open class var tertiarySystemBackground: UIColor { get }
 open class var systemGroupedBackground: UIColor { get }
 open class var secondarySystemGroupedBackground: UIColor { get }
 open class var tertiarySystemGroupedBackground: UIColor { get }
 open class var systemFill: UIColor { get }
 open class var secondarySystemFill: UIColor { get }
 open class var tertiarySystemFill: UIColor { get }
 open class var quaternarySystemFill: UIColor { get } ˞J04Ͱ૿͑ͨ৭ͷҰཡͳͷͰશ͕ͯ%BSLNPEFରԠ͔Ͳ͏͔͸֬ೝ͍ͯ͠·ͤΜ
  3. *NQMFNFOUTXJUIDPEF w USBJU$PMMFDUJPOͷVTFS*OUFSGBDF4UZMFϓϩύςΟΛར༻ public enum UIUserInterfaceStyle : Int { case

    unspecified case light case dark } w ΧελϜ%ZOBNJD$PMPSΛ࡞੒ let dynamicColor = UIColor { traitCollection -> UIColor in switch traitCollection.userInterfaceStyle { case .dark: return .red default: return .blue } }
 
 etc…
  4. *NQMFNFOUTXJUIDPEF w ໌ࣔతʹϋϯυϦϯά let dynamicColor = UIColor.systemBackground let traitCollection =

    view.traitCollection let resolvedColor = dynamicColor.resolvedColor(with: traitCollection)
 let resolvedImage = image.imageAsset?.image(with: traitCollection) w ΠϕϯτϋϯυϦϯά *NQMFNFOUJOH%BSL.PEFPOJ04  ΑΓҾ༻
  5. 13

  6. • αʔόʔαΠυΤϯδχΞ (PHP, Golang, AWS) • AndroidΤϯδχΞ (Kotlin) • iOSΤϯδχΞ

    (Swift) TimersͰ͸ݱࡏΤϯδχΞશ৬छ࠾༻தʂ
 ৄ͘͠͸”Timers”Ͱݕࡧ