All Projects → Blackjacx → Columbus

Blackjacx / Columbus

Licence: MIT license
A feature-rich country picker for iOS, tvOS and watchOS.

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to Columbus

TermiNetwork
🌏 A zero-dependency networking solution for building modern and secure iOS, watchOS, macOS and tvOS applications.
Stars: ✭ 80 (+247.83%)
Mutual labels:  tvos, watchos, carthage, swiftui
Color
Color utilities for macOS, iOS, tvOS, and watchOS
Stars: ✭ 145 (+530.43%)
Mutual labels:  tvos, watchos, carthage, spm
stinsen
Coordinators in SwiftUI. Simple, powerful and elegant.
Stars: ✭ 563 (+2347.83%)
Mutual labels:  tvos, watchos, swiftui
Cache
Swift caching library
Stars: ✭ 210 (+813.04%)
Mutual labels:  tvos, watchos, carthage
ScaledFont
ScaledFont - Using custom fonts with dynamic type
Stars: ✭ 50 (+117.39%)
Mutual labels:  tvos, watchos, swiftui
Dots
Lightweight Concurrent Networking Framework
Stars: ✭ 35 (+52.17%)
Mutual labels:  tvos, watchos, carthage
L10n Swift
Localization of the application with ability to change language "on the fly" and support for plural form in any language.
Stars: ✭ 177 (+669.57%)
Mutual labels:  tvos, watchos, carthage
Wwdc
You don't have the time to watch all the WWDC session videos yourself? No problem me and many contributors extracted the gist for you 🥳
Stars: ✭ 2,561 (+11034.78%)
Mutual labels:  tvos, watchos, swiftui
Ducttape
📦 KeyPath dynamicMemberLookup based syntax sugar for Swift.
Stars: ✭ 138 (+500%)
Mutual labels:  tvos, watchos, carthage
KeyboardKitPro
KeyboardKit Pro extends KeyboardKit with pro features.
Stars: ✭ 42 (+82.61%)
Mutual labels:  tvos, watchos, swiftui
SwiftCurrent
A library for managing complex workflows in Swift
Stars: ✭ 286 (+1143.48%)
Mutual labels:  tvos, watchos, swiftui
data-field
A SwiftUI view that wraps a text field to only accept specific data.
Stars: ✭ 13 (-43.48%)
Mutual labels:  tvos, watchos, swiftui
Cocoalumberjack
A fast & simple, yet powerful & flexible logging framework for Mac and iOS
Stars: ✭ 12,584 (+54613.04%)
Mutual labels:  tvos, watchos, carthage
Cdmarkdownkit
An extensive Swift framework providing simple and customizable markdown parsing.
Stars: ✭ 158 (+586.96%)
Mutual labels:  tvos, watchos, carthage
IrregularGradient
Create animated irregular gradients in SwiftUI.
Stars: ✭ 127 (+452.17%)
Mutual labels:  tvos, watchos, swiftui
Iso8601
ISO8601 date parser and writer
Stars: ✭ 213 (+826.09%)
Mutual labels:  tvos, watchos, carthage
Mechanica
A cross-platform library of Swift utils to ease your iOS | macOS | watchOS | tvOS and Linux development.
Stars: ✭ 27 (+17.39%)
Mutual labels:  tvos, watchos, carthage
Sqift
Powerful Swift wrapper for SQLite
Stars: ✭ 119 (+417.39%)
Mutual labels:  tvos, watchos, carthage
Contentful.swift
A delightful Swift interface to Contentful's content delivery API.
Stars: ✭ 132 (+473.91%)
Mutual labels:  tvos, watchos, carthage
WWDCNotes
WWDCNotes.com content
Stars: ✭ 343 (+1391.3%)
Mutual labels:  tvos, watchos, swiftui

Columbus

Twitter CI status Github Current Release Cocoapods Platforms Xcode 12.5+ iOS 11.0+ Swift 5.4+ Github Repo Size Github Code Size Github Closed PR's Carthage compatible License codebeat badge
Donate

A country picker for iOS, tvOS ad watchOS with features you will only find distributed in many different country-picker implementations.

Features

  • Filter countries using an as-you-type search bar - type the name or it's country code
  • Quickly find a country by using the indexbar on the right
  • Localized by using standard components and Apple's Locale class
  • Theme support to easily fit to your design
  • Storyboard support
  • Select a country from the history of selected countries - still in progress

Installation

Carthage (recommended)

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate Columbus into your Xcode project using Carthage, specify it in your Cartfile:

github "Blackjacx/Columbus"

The use the following command to build the XCFramework:

carthage bootstrap --use-ssh --use-xcframeworks --cache-builds

Using Carthage has some advantages in contrast to Cocopods for this framework. Since it needs to compile the asset catalog for over 200 flag assets it is much faster to build the framework once using Carthage and drop it into your app. If you use Cocoapods the asset catalog is compiled together with Columbus each time you do a clean build and probably also when Xcode thinks Columbus needs to be compiled again.

CocoaPods

To install via CocoaPods, simply add the following line to your Podfile and run pod install to install the newest version:

pod "Columbus"

Examples

Usage

In the following example you'll find all the possible configuration/theming options of Columbus:

struct CountryPickerConfig: Configurable {

    var displayState = CountryPickerViewController.DisplayState.countryCodeSelection
    /// In this example this has to be a computed property so the font object
    /// is calculated later on demand. Since this object is created right at app
    /// start something related to dynamic type seems not to be ready yet.
    var textAttributes: [NSAttributedString.Key: Any] {
        [
            .foregroundColor: UIColor.text,
            .font: UIFont.preferredFont(forTextStyle: .body)
        ]
    }
    var textFieldBackgroundColor: UIColor = .textFieldBackground
    var backgroundColor: UIColor = .background
    var selectionColor: UIColor = .selection
    var controlColor: UIColor = UIColor(red: 1.0 / 255.0, green: 192.0 / 255.0, blue: 1, alpha: 1)
    var lineColor: UIColor = .line
    var lineWidth: CGFloat = 1.0 / UIScreen.main.scale
    var rasterSize: CGFloat = 10.0
    var separatorInsets: UIEdgeInsets {
        UIEdgeInsets(top: 0, left: rasterSize * 4.7, bottom: 0, right: rasterSize * 2.5)
    }
    let searchBarAttributedPlaceholder: NSAttributedString = {
        NSAttributedString(string: "Search",
                           attributes: [
                            .foregroundColor: UIColor.placeholder,
                            .font: UIFont.preferredFont(forTextStyle: .body)])
    }()
}
let countryPicker = CountryPickerViewController(config: CountryPickerConfig(),
                                                initialCountryCode: "US") { (country) in
    print(country)
}
present(countryPicker, animated: true)

Storyboards

Good news for our storyboard users. I implemented full storyboard support - but for iOS 13 only. You'll need a fallback for earlier versions. To instantiate the picker from a storyboard you can use the following example:

if #available(iOS 13.0, *) {
    let defaultCountry = CountryPickerViewController.defaultCountry(from: "US")
    let picker: CountryPickerViewController = storyboard.instantiateViewController(identifier: "Picker") { (coder) -> CountryPickerViewController? in
        return CountryPickerViewController(configcoder: coder, initialCountryCode: defaultCountry.isoCountryCode) { (country) in
            print(country)
        }
    }
} else {
    // Fallback on earlier versions
}

The above example gives you a non-optional instance of CountryPickerViewController. This new syntax also enables us to provide parameters for a storyboard-initialized view (controller). This prevents the addition of optional properties like in previous versions of iOS which is a huge progress.

iOS

The repo includes an example project. It shows the main use case of the project - the country picker. To run it, just type pod try Columbus in your console and it will be downloaded and opened for you. The following set of screenshots highlights the key features unique to Columbus:

Filtering Indexbar History Localization Theming
Searchbar Indexbar History Localization Theming

tvOS

... still in progress ...

watchOS

... still in progress ...

Contribution

  • If you found a bug, please open an issue.
  • If you have a feature request, please open an issue.
  • If you want to contribute, please submit a pull request.

Author

Stefan Herold🐦 @Blackjacxxx

Links

Localize the cancel button of a UISearchBar

Credits

Thanks for the flag icons

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].