π· SwiftUI TagField π·
πΉ Preview
π Getting Started
Requirements
- Xcode 11+
- SwiftUI
- iOS 14+
- macOS 10.15+
Installaion
Swift Package Manager(SPM)
File β Swift Packages β Add Package Dependancy..
.package(url: "https://github.com/Changemin/TagField", from: "1.1.0")
πUsage
TagField(tags: $tags, placeholder: "Add Tags..")
TagField(tags: $tags, placeholder: "Add Tags..", prefix: "#")
TagField(tags: $tags, placeholder: "Add Tags..", prefix: "#", color: color, style: .Modern, lowercase: bool)
tags
:Binding<String>
that stores tags dataplaceholder
: placeholder text before add tagsprefix
: prefix attached to each tagscolor
: accentColorstyle
:TagFieldStyle
β.Modern
,.RoundedBorder
,.Multilined
π Custom Modifiers
TagField(tags: $tags, placeholder: "Add Tags..")
.accentColor(color)
.styled(TagFieldStyle)
.lowercase(Bool)
.accentColor()
: Accent color.styled()
:.RoundedBorder(default)
.Modern
.Multilined(on progress)
support different designs.lowercase
: enable force lowercase
Example
πΆ Simple
import TagField
struct ContentView: View {
@State var tags: [String] = []
var body: some View {
TagField(tags: $tags, placeholder: "Add Tags..")
.padding()
}
}
Result
Styling
import TagField
struct ContentView: View {
@State var tags: [String] = []
var body: some View {
TagField(tags: $tags, placeholder: "Add Tags..", prefix: "#")
.styled(.Modern)
.accentColor(.red)
.lowercase(true)
.padding()
}
}
Result
β TODO
-
Multilined
style
π License
TagField is available under the MIT license. See the LICENSE
file for more info.
βοΈ Author
- Byun Kyung Min β π°π·@Changemin