Giter Site home page Giter Site logo

eleev / column-text-view-ui Goto Github PK

View Code? Open in Web Editor NEW
14.0 3.0 1.0 46.02 MB

๐Ÿ“„ Column Text View is an adaptive UI component that renders text in columns, horizontally [iOS 12, UIKit, TextKit, SwiftUI].

License: MIT License

Swift 100.00%
swift ios uikit textkit swiftui ui-component coregraphics core-graphics spm swift-package-manager

column-text-view-ui's Introduction

column-text-view-ui Awesome

Build Platform Platform Language SPM License

Last Update: 29/December/2019.

If you like the project, please give it a star โญ It will show the creator your appreciation and help others to discover the repo.

โœ๏ธ About

๐Ÿ“„ Column Text View is an adaptive UI component that renders text in columns, horizontally [iOS 12, UIKit, TextKit, SwiftUI].

๐Ÿ“บ Demo

Please wait while the .gif files are loading...

๐Ÿฑ Features

  • Configurable
    • There are a number of configurable properties and you can use, such as, you can specify the number of columns for the supplied text, specify column spacing, paddings and other properties
  • Adaptive
    • The underlying text container adjusts its size to support the needed amount of space for the supplied text
  • SwiftUI Compatable
    • You can use a dedicated wrapper called ColumnedTextView to use the componet with SwiftUI
  • Ease of Use
    • Instantiate a single instane of ColumnTextView or ColumnedTextView (for SwiftUI ), setup the parent view and supply some text
  • Designable and Inspectable
    • You can use .storyboard or .xib files to configure the component without touching code (well, almost)

๐Ÿ“š Usage

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
  • (1) The first part is instantiation and setup. Here we have pretty usual things happenning, nothing exotic ๐ŸŒด. You can specify the way the columns should be created. Here you have two options: to use .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.
  • (2) The next part is about the text 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.

๐Ÿ— Installation

Swift Package Manager

Xcode 11+

  1. Open MenuBar โ†’ File โ†’ Swift Packages โ†’ Add Package Dependency...
  2. Paste the package repository url https://github.com/jVirus/column-text-view-ui and hit Next.
  3. Select the installment rules.

After specifying which version do you want to install, the package will be downloaded and attached to your project.

Package.swift

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")
]

Manual

You can always use copy-paste the sources method ๐Ÿ˜„. Or you can compile the framework and include it with your project.

๐Ÿ™‹โ€โ™€๏ธ๐Ÿ™‹โ€โ™‚๏ธ Contributing

Your contributions are always appreciated. There are many ways how you help with the project:

  • You can suggest something
  • You can write additional documentation or sample codes
  • Implement a new feature
  • Fix a bug
  • Help to maintain by answering to the questions (if any) that other folks have
  • etc.

Overall guidelies are:

  • Please, discuss a feature or a major source change/addition before spending time and creating a pool requested via issues.
  • Create a separate branch and make sure that your code compiles and does not produce errors and warnings.
  • Please, don't be upset if it takes a while to review your code or receive an answer.

๐Ÿ‘จโ€๐Ÿ’ป Author

Astemir Eleev

๐Ÿ”– Licence

The project is available under MIT Licence

column-text-view-ui's People

Contributors

eleev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

ruschr

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.