Skip to content

sitale/FBTagGrid

Repository files navigation

Grid

Overview

Grid is a powerful and easy way to layout your views in SwiftUI:

Installation

CocoaPods

Grid is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'FBTagGrid'

Use

import  FBTagGrid

struct Item : Identifiable , FBGridItemSize {
    var id:String  = UUID().uuidString
    
    var text: String
    
    var size: CGSize {
        (text as NSString).boundingRect(with: CGSize(width: CGFloat(MAXFLOAT), height: CGFloat(MAXFLOAT)), options: .usesLineFragmentOrigin, attributes: [.font: UIFont.systemFont(ofSize: 16)], context: nil).size
    }
}



struct ContentView: View {

    var items:[Item] = []
    
    var body: some View {
        FBTagGrid(items) { 
            Text($0.text).font(.system(size: 16))
        }
    }
}

License

Grid is available under the MIT license. See the LICENSE file for more info.

About

A simple Grid tagView layout wrritten with SwiftUI

Resources

Stars

Watchers

Forks

Packages

No packages published