A place to experiment with WidgetKit. This readme has notes from official apple video about WidgetKit and glimpse of my applications.
Should project content from application than having tiny buttons!
- Glanceble
- Relevant
- Personalized
Widget kit is build entirely on SwiftUI - making it cross platform.
WidgetKit Course By Sean Allen
A Color was made by using Random RGB Values as follows
// Keep in mind that it should be Double and NOT Int
let redValue = Double.random(in: 1...255)
let blueValue = Double.random(in: 1...255)
let greenValue = Double.random(in: 1...255)
// Making the Color
let baseColor = Color(red:redValue/255,green:greenValue/255,blue:blueValue/255)
For the text I wanted a complementory Color, which was made using the RGB values of Base Color
// RBG Values of the baseColor
func complementColorGen(red: Double, green: Double, blue: Double) -> Color {
// r' = max(r,b,g) + min(r,b,g) - r
// b' = max(r,b,g) + min(r,b,g) - b
// g' = max(r,b,g) + min(r,b,g) - g
let axis : Double = max(red,blue,green) + min(red,blue,green)
let redValue = axis - red
let blueValue = axis - blue
let greenValue = axis - green
return Color(red:redValue/255,green:greenValue/255,blue:blueValue/255)
}
And, for producing a random Emoji - used the following code
func RandEmojGen() -> String {
return String(UnicodeScalar(Array(0x1F300...0x1F3F0).randomElement()!)!)
}