Skip to content

tuanngodoan/Digital-Clock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Digital-Clock

  • UI/UX : I use font Digital, background search google image. // So bad :(

###Timer.

  • Timer.Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(ViewController.updateTime), userInfo: nil, repeats: true)
    • timeInterval: number sec will repeat once
    • target: target /self : screen iphone
    • selector: #selector(func) : func repeat
    • repeats: true // after timeInterval. Is it repeat again? true is yes.

GET time

  • let date  = Date() // get infomation date now
    let calendar = NSCalendar.current 
    let requestedComponents :NSCalendar.Unit = [  // type date
        NSCalendar.Unit.hour, 
        NSCalendar.Unit.minute,
        NSCalendar.Unit.second,
        NSCalendar.Unit.day,
        NSCalendar.Unit.month,
        NSCalendar.Unit.year,
        NSCalendar.Unit.weekOfYear,
    ]
    
    let components = (calendar as NSCalendar).components(requestedComponents, from: date) 
    

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages