/
TextInputInfoViewExample.swift
49 lines (41 loc) · 2.67 KB
/
TextInputInfoViewExample.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
import FioriSwiftUICore
import SwiftUI
struct TextInputInfoViewExample: View {
var body: some View {
VStack(alignment: .leading) {
Text("Default Fiori style, no icon")
.textInputInfoView(description: AttributedString("test message"), counter: AttributedString("10/100"))
Text("Error style")
.textInputInfoView(description: AttributedString("test message, long messag long message long message long message long message long message long message long message"), counter: AttributedString("12/10"))
.textInputInfoViewStyle(.error)
Text("Warning style")
.textInputInfoView(description: AttributedString("test message, long messag long message long message long message long message long message long message long message"), counter: AttributedString("10/10"))
.textInputInfoViewStyle(.warning)
Text("Informational style")
.textInputInfoView(description: AttributedString("test message"), counter: AttributedString("0/10"))
.textInputInfoViewStyle(.informational)
Text("Success style")
.textInputInfoView(description: AttributedString("test message"), counter: AttributedString("10/100"))
.textInputInfoViewStyle(.success)
Text("Customized icon")
.textInputInfoView(icon: Image(systemName: "heart"), description: AttributedString("test message, long messag long message long message long message long message long message long message long message"), counter: AttributedString("10/100"))
Text("Customized font and color")
.textInputInfoView(icon: Image(systemName: "diamond"), description: AttributedString("test message"), counter: AttributedString("10/100"))
.iconStyle(content: { iconConfiguration in
iconConfiguration.icon
.foregroundStyle(Color.preferredColor(.tintColor))
})
.descriptionStyle(content: { descriptionConfiguration in
descriptionConfiguration.description
.foregroundStyle(Color.preferredColor(.criticalLabel))
.font(.fiori(forTextStyle: .title2))
})
.counterStyle(content: { counterConfiguration in
counterConfiguration.counter
.foregroundStyle(Color.preferredColor(.criticalLabel))
.font(.fiori(forTextStyle: .title2))
})
Spacer()
}
}
}