-
Notifications
You must be signed in to change notification settings - Fork 0
/
Day02-Colors&Images.swift
54 lines (47 loc) · 1.48 KB
/
Day02-Colors&Images.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
48
49
50
51
52
53
54
//
// ContentView.swift
// Text
//
// Created by Dali Han on 2020/7/24.
//
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
// sf symbols like text
Image(systemName: "lasso")
.font(.largeTitle)
.foregroundColor(.red)
// add images to assets
// image is view
Image("general")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 200)
// .clipShape(Circle())
.cornerRadius(22)
// built-in colors
Text("Poems")
.background(Color.blue)
.padding(.all, 10)
Text("Poems")
.padding(.all, 10)
.background(Color.red)
.cornerRadius(22)
.rotationEffect(Angle(degrees: 30), anchor: .center)
// color literals
// color is view
Color(#colorLiteral(red: 0.7450980544, green: 0.1568627506, blue: 0.07450980693, alpha: 1))
.padding(.all, 10)
.frame(width: 100, height: 100, alignment: .center)
}
// color sets in assets
// you can ignore safe areas
.background(Color("brand")).edgesIgnoringSafeArea(.all)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}