Skip to content

pawellazarew/TagsGridView

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TagsGridView: A simple view for your tags.

Requirements

  • iOS 14, macOS 10.15
  • Swift 5.5
  • Xcode 12.5+

Installation

The preferred way of installing SwiftUIX is via the Swift Package Manager.

Xcode 12 integrates with libSwiftPM to provide support for iOS, watchOS, macOS and tvOS platforms.

  1. In Xcode, open your project and navigate to FileSwift PackagesAdd Package Dependency...
  2. Paste the repository URL (https://github.com/alexwillrock/TagsGridView) and click Next.
  3. For Rules, select Branch (with branch set to master).
  4. Click Finish.

Contents

Prepare view model

struct Tag: Hashable {
    let title: String
    let color: Color
}

Draw tag view

struct TagView: View {    
    let tag: Tag
    
    var body: some View {
        Text(tag.title)
            .lineLimit(1)
            .font(.caption2)
            .padding(.all, 6)
            .background {
                RoundedRectangle(cornerRadius: 8)
                    .foregroundColor(tag.color)
            }
    }
}

Implemente TagsGridView

    var body: some View {
        HStack {
            Spacer()
            
            TagsGridView(data: tags,
                     spacing: 4,
                     alignment: .leading) { item in
                TagView(tag: item)
                    .frame(height: 25)
            }
            
            Spacer()
        }
    }

Visual

image

License

TagsGridView is licensed under the MIT License.

Support

Contact me

Credits

TagsGridView is a project of @alexwillrock.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 100.0%