Skip to content

changemin/TagField

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

20 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿท SwiftUI TagField ๐Ÿท

License Release


๐Ÿ“น 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 data
  • placeholder: placeholder text before add tags
  • prefix : prefix attached to each tags
  • color : accentColor
  • style : 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