ContactCircularView 1.1.2

ContactCircularView 1.1.2

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Oct 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by k8mil.


Downloads

Total3,969
Week0
Month0

Installs

Apps59
Pod Tries3
Test Targets3
powered by Segment

GitHub

Stars4
Watchers2
Forks1
Issues0
Contributors1
Pull Requests0

Code

Files3
LOCLines of Code 158


  • By
  • Kamil Wysocki

ContactCircularView

Why to use

If you want to add some custom ContactsBook screen or you just need come circular view with some text or image inside, this pod is suitable for your app.

Demo

Example app

Contact screen

Examples

To run the example project, clone the repo, and run pod install from the Example directory first.

Create, apply initials from name, set font and border

let contactInitialsView = ContactCircularView()
contactInitialsView.backgroundColor = UIColor.redColor()
contactInitialsView.applyBorderWithColor(.greenColor(), andWidth: 1.0)
contactInitialsView.applyTextFont(.italicSystemFontOfSize(12), andColor: .greenColor())
contactInitialsView.applyInitialsFromName("John Doe")

Create, apply image

let contactInitialsView = ContactCircularView()
contactInitialsView.applyImage(UIImage(imageLiteral: "some_cool_image"))

Create your custom TextFormatter, and initialize ContactCircularView with it

class FirstLetterFormatter: FormattedTextCreator {

    func formattedTextFromString(string: String) -> String {
        guard let firstLetter = string.characters.first else {
            return ""
        }
        return String(firstLetter)
    }

}
let contactInitialsView = ContactCircularView(textCreator: FirstLetterFormatter())
contactInitialsView.backgroundColor = UIColor.redColor()
contactInitialsView.applyTextColor(UIColor.whiteColor())
contactInitialsView.applyFormattedTextFromString("John Doe")

Create an circularView and make the UIImage from it

let contactInitialsView = ContactCircularView(textCreator: FirstLetterFormatter())
contactInitialsView.frame = CGRectMake(0,0,30,30)
contactInitialsView.backgroundColor = UIColor.redColor()
contactInitialsView.applyTextColor(UIColor.whiteColor())
contactInitialsView.applyFormattedTextFromString("John Doe")

let image = contactInitialsView.toImage()

Requirements

version 1.1.0+ Swift 3.0, Xcode 8

version 1.0.2 Swift 2.2, Xcode 7

Installation

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

pod "ContactCircularView"

Author

Kamil Wysocki

License

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