📄 Column Text View is an adaptive UI component that renders text in columns, horizontally [iOS 12, UIKit, TextKit, SwiftUI].
Last Update: 29/December/2019.
📄 Column Text View is an adaptive UI component that renders text in columns, horizontally [iOS 12, UIKit, TextKit, SwiftUI].
Please wait while the .gif
files are loading…
ColumnedTextView
to use the componet with SwiftUI
ColumnTextView
or ColumnedTextView
(for SwiftUI
), setup the parent view and supply some text.storyboard
or .xib
files to configure the component without touching code (well, almost)The first thing you need to do is to prepare the UI component. The following example demostrates the programmatic approach, where the component is instantiated without .storyboard
or .xib
outlets:
// 1
let columnTextView = ColumnTextView(frame: view.bounds, .columns(2))
columnTextView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
columnTextView.backgroundColor = .white
parentView.addSubview(columnTextView)
// 2
columnTextView.attributedText = attributedString
.absolute(***UInt16***)
, where the associated parameter is a single column width
in points or to use .columns(***UInt16***)
, where the associated parameter is a positive integer number that specifies the exact number of columns that should be created for the current screen’s width
.attachment
. You simply create an instance of NSAttributedString
, configure it as you’d like and that’s it. You can change the attributedText
property, the results will be correspondigly reflected and specify all four
paddings for top, right, bottom and left
sides of the component.
MenuBar
→ File
→ Swift Packages
→ Add Package Dependency...
https://github.com/jVirus/column-text-view-ui
and hit Next
.After specifying which version do you want to install, the package will be downloaded and attached to your project.
If you already have a Package.swift
or you are building your own package simply add a new dependency:
dependencies: [
.package(url: "`https://github.com/jVirus/column-text-view-ui", from: "1.0.0")
]
You can always use copy-paste the sources method 😄. Or you can compile the framework and include it with your project.
Your contributions are always appreciated. There are many ways how you help with the project:
Overall guidelies are:
The project is available under MIT Licence