-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContents.swift
47 lines (36 loc) · 1.37 KB
/
Contents.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//: Playground - noun: a place where people can play
import UIKit
import RatingSlider
import PlaygroundSupport
// Open Assistant Editor to see live view. Hit: ⌥⌘↵
let container = UIView(frame: CGRect(x: 0, y: 0, width: 300, height: 200))
container.backgroundColor = .white
let thumb = Thumb(size: 34,
hole: 6,
cornerRadius: 17,
color: .white,
shadowColor: .black)
let frame = CGRect(x: 20, y: 100, width: 260, height: 60)
let dottedStyle = GridStyle.dotted(.init(
activeColor: .blue,
activeSize: 6,
inactiveColor: .brown,
inactiveSize: 3,
labels: .init(
activeColor: .red,
inactiveColor: .green)
)
)
let labeledStyle = GridStyle.labeled(.init(
activeFont: .boldSystemFont(ofSize: 12),
activeColor: .red,
inactiveFont: .italicSystemFont(ofSize: 6),
inactiveColor: .blue)
)
let ratingSlider = RatingSlider(frame: frame, gridStyle: dottedStyle, thumb: thumb)
ratingSlider.activeTrackColor = #colorLiteral(red: 0.9425747991, green: 0.8432862163, blue: 0.1268348098, alpha: 1)
ratingSlider.inactiveTrackColor = #colorLiteral(red: 0.8508961797, green: 0.8510394692, blue: 0.850877285, alpha: 1)
ratingSlider.range = 0...10
ratingSlider.startThumbSwingAnimation(power: 2.5, duration: 0.3)
container.addSubview(ratingSlider)
PlaygroundPage.current.liveView = container