TagField
π· Simple Tag Field for SwiftUI
Install / Use
/learn @byunkyungmin/TagFieldREADME
<p align="center">
<a href="" rel="noopener">
<img width=300px src="imgs/main.gif"></a>
</p>
<h3 align="center">π· SwiftUI TagField π·</h3>
<div align="center">
πΉ Preview
<p align="center"> <img src="imgs/appVideo.gif" width="40%" /> </p>π 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
<p float="left"> <img src="imgs/Example-simple-1.png" width="25%"> <img src="imgs/Example-simple-2.png" width="25%"> </p>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
<p float="left"> <img src="imgs/Example-styling-1.png" width="25%"> <img src="imgs/Example-styling-2.png" width="25%"> </p>β TODO
- [ ]
Multilinedstyle
π License
TagField is available under the MIT license. See the LICENSE file for more info.
βοΈ Author
- Byun Kyung Min β π°π·@Changemin
