Grid is a powerful and easy way to layout your views in SwiftUI:
Grid is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'FBTagGrid'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))
}
}
}Grid is available under the MIT license. See the LICENSE file for more info.
