티스토리 뷰
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
|
import SwiftUI
struct ContentView: View {
@State private var progress: CGFloat = 0
var body: some View {
VStack{
Slider(value: $progress)
.padding()
ZStack{
Circle()
.stroke(Color.gray.opacity(0.3), lineWidth: 20)
Circle()
.trim(from: 0, to: progress)
.stroke(style: StrokeStyle(lineWidth: 20, lineCap: .round, lineJoin: .round))
.fill(progress == 1 ? Color.green : Color.red)
.rotationEffect(.degrees(-90))
.animation(.easeInOut)
Text("\(String(format: "%.2f", progress * 100))"+"%")
.foregroundColor(progress == 1 ? Color.green : Color.red)
.font(.largeTitle)
}.padding()
}
}
}
|
cs |
- progress : 진행율 나타냄.
- Slider로 진행율 pickup
- ZStack : Circle두개 겹침
- trim으로 분할원생성 -> stroke (StrokeStyle로 세부 설정) 가 선 모양만 남기고 거름
- fill, rotationEffect, animation
'iOS 개발 > SwiftUI' 카테고리의 다른 글
SwiftUI) json networking (0) | 2022.02.15 |
---|---|
SwiftUI) @State, @Binding 예제 (0) | 2022.01.31 |
SwiftUI) ScrollView 예제 (0) | 2022.01.30 |
SwiftUI) TextEditor 예제 (0) | 2022.01.30 |
SwiftUI) Toggle Custom 예제 (0) | 2022.01.30 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 주입
- XcodeBuildSystem
- swiftc
- 순환참조
- 의존관계역전법칙
- 알고리즘
- 프로그래머스
- 링커
- 클린 코드 줄거리
- 클린 코드 정리
- 전처리기
- 메모리 순환참조
- Swift
- XCFramework
- BFS
- 여행경로
- 면접질문
- 의존성
- SwiftUI
- dfs
- 학교 과제
- ios simulator
- 클린 코드
- clean code
- CLANG
- ios
- 이분탐색
- clean code 정리
- 단어변환
- 생명 주기
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함