Swiftpack.co - hlwanhoj/TagListView as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by hlwanhoj.
hlwanhoj/TagListView 1.0.0
A tag list view in Swift for iOS
⭐️ 1
🕓 1 year ago
iOS
.package(url: "https://github.com/hlwanhoj/TagListView.git", from: "1.0.0")

TagListView

output

TagListView is a container view which aligns its children(tags) from left to right and from top to bottom. It has the following benefits:

  • The alignment is done by setting children' frames and not using Auto Layout, which should theoretically give a faster layout calculation.
  • It adjusts its height to fit all its children automatically.
  • Its children can be any subclass of UIView.

Features

output

var alignment: Alignment { get set }

It controls how the children within a row should be placed in the main axis. Possible values are start, center and end.

output

var crossAxisAlignment: Alignment { get set }

It controls how the children within a row should be aligned relative to each other in the cross axis. Possible values are start, center and end.

output

var spacing: CGFloat { get set }

It controls how much space to place between children in a row in the main axis.

output

var rowSpacing: CGFloat { get set }

It controls how much space to place between the rows themselves in the cross axis.

func addTagView(_ view: UIView)
func removeTagView(_ view: UIView)

These two functions should be used to manage tags rather than addSubview and removeFromSuperview.

Remarks

For TagListView to layout properly its width must be constrainted horizontally by

  • Setting a width constraint equal to a constant.
  • Setting left and right constraints with 'equal' relation.
  • Setting the frame's width directly.

Installation

Swift Package Manager

This repository is ready as a package for SPM.

Manually

Just drag Sources/TagListView/TagListView.swift to your project and it's all done.

GitHub

link
Stars: 1
Last commit: 13 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics