All Projects → renaudjenny → Swiftclockui

renaudjenny / Swiftclockui

Licence: mit
SwiftUI library to display a clock. You can move the arms to change the time, change the style of the clock and customise some configurations.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Swiftclockui

Rhine
Haskell Functional Reactive Programming framework with type-level clocks
Stars: ✭ 69 (-56.6%)
Mutual labels:  clock
Stc diyclock
STC DIY Clock redux (STC15F204EA, STC15W404AS, STC15W408AS)
Stars: ✭ 130 (-18.24%)
Mutual labels:  clock
Literature Clock
Clock using time quotes from the literature, based on the work of Jaap Meijers
Stars: ✭ 145 (-8.81%)
Mutual labels:  clock
My Appdaemon
My apps, my helpfiles, all about AppDaemon for Home Assistant
Stars: ✭ 94 (-40.88%)
Mutual labels:  clock
Rcalendarpicker
RCalendarPicker A date picker control, Calendar calendar control, select control, calendar, date selection, the clock selection control. 日历控件 ,日历选择控件,日历,日期选择,时钟选择控件
Stars: ✭ 121 (-23.9%)
Mutual labels:  clock
Analog clock
⌚️Analog Clock widget for Flutter ⏰
Stars: ✭ 136 (-14.47%)
Mutual labels:  clock
Truetime Android
Android NTP time library. Get the true current time impervious to device clock time changes
Stars: ✭ 1,134 (+613.21%)
Mutual labels:  clock
React Clock
An analog clock for your React app.
Stars: ✭ 149 (-6.29%)
Mutual labels:  clock
Uicircularprogressring
A circular progress bar for iOS written in Swift
Stars: ✭ 1,658 (+942.77%)
Mutual labels:  clock
Si5351arduino
Library for the Si5351 clock generator IC in the Arduino environment
Stars: ✭ 141 (-11.32%)
Mutual labels:  clock
Use Timer
A timer hook for React
Stars: ✭ 113 (-28.93%)
Mutual labels:  clock
Windows Hangul Clock
Hangul Clock for Windows Desktop Widget
Stars: ✭ 118 (-25.79%)
Mutual labels:  clock
Flipdown
⏰ A lightweight and performant flip styled countdown clock
Stars: ✭ 136 (-14.47%)
Mutual labels:  clock
Flip Clock
A flip clock, timer and countdown made with Polymer
Stars: ✭ 69 (-56.6%)
Mutual labels:  clock
Mac Hanguldesktop Clock
Hangul Desktop Clock for Mac
Stars: ✭ 146 (-8.18%)
Mutual labels:  clock
Vue Clock2
vue clock component 😀
Stars: ✭ 67 (-57.86%)
Mutual labels:  clock
Tzupdate
Set the system timezone based on IP geolocation
Stars: ✭ 130 (-18.24%)
Mutual labels:  clock
Server Date
Make the server's clock available in the browser.
Stars: ✭ 157 (-1.26%)
Mutual labels:  clock
Carettab
CaretTab - New Tab Page Replacement
Stars: ✭ 147 (-7.55%)
Mutual labels:  clock
Amazing Time Picker
Timepicker (Clock Picker) for Angular 2, Angular 4 and Angular 5, Angular 6, Angular 7 - Compatible with Angular Material
Stars: ✭ 142 (-10.69%)
Mutual labels:  clock

SwiftClockUI

Xcode Unit Test

Clock UI for SwiftUI

This library has been tested

  • ✅💻 macOS Catalina 10.15.3
  • ✅📱 iOS 13
  • ✅📱 iOS 14

Bind a date

struct ContentView: View {
    @State private var date = Date()

    var body: some View {
        ClockView().environment(\.clockDate, $date)
    }
}

Simply set .environment(\.clockDate, $date) $date has to be a binding. If you want something constant (just for showing the time), you could pass .constant(yourDate)

  • Arms move when date are set (take hour and minute in account)
  • Move the Arms change the date (hour and minute depending on which arm you've moved)

Change Clock style

There is 4 different clock style:

Style Picture
Classic Clock View with Classic style
Art Nouveau Clock View with Art Nouveau style
Drawing Clock View with Drawing style
Steampunk Clock View with Steampunk style

To set the style: .environment(\.clockStyle, .steampunk) for Steampunk style for instance.

struct ContentView: View {
    @State private var clockStyle: ClockStyle = .classic

    var body: some View {
        ClockView().environment(\.clockStyle, clockStyle)
    }
}

\.clockStyle is typed as enum ClockStyle which is Identifiable, CaseIterable, and has a convenient method to get the description (in English): public var description: String

It's very useful when you want to iterate over this enum to let the user choose the clock style, for instance you can easily do something like this:

struct StylePicker: View {
    @Binding var clockStyle: ClockStyle

    var body: some View {
        Picker("Style", selection: clockStyle) {
            ForEach(ClockStyle.allCases) { style in
                Text(style.description).tag(style)
            }
        }
        .pickerStyle(SegmentedPickerStyle())
    }
}

Change elements color

You can also change the color of Clock elements. Again with changing some .environment keys.

ClockView()
    .environment(\.clockArmColors, ClockArmColors(
        minute: .red,
        hour: .blue
    ))
    .environment(\.clockBorderColor, .orange)
    .environment(\.clockIndicatorsColor, .green)

In light mode, you could expect a result like this:

Clock View with Classic style and some colors changed

App using this library

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].