CountryPickerAKS

0.6.0

Streamline country selection with ease. Customize themes, add countries, optimize lists – all tailored to your app. A simple, powerful choice for an enhanced user experience. 🌐✨
aksamitsah/CountryPickerAKS

What's New

Release 0.6.0

2023-11-24T04:05:20Z



Platform: iOS iOS 11+ Swift 5.0+ XCode 14.x+

spm compatible Cocopod compatible

Streamline country selection with ease. Customize themes, add countries, optimize lists – all tailored to your app. A simple, powerful choice for an enhanced user experience. 🌐✨

⛳️ CountryPickerAKS

😳 Features

  • Appearance available for both Light and Dark modes
  • Customizable Font to match your App's style for Country, Country Code, and Search
  • Enable or Disable Local Country on Top option
  • Customizable theme based on your App's primary, secondary, and text colors
  • Add Custom Country if desired
  • Alter Country List according to your preference (Top, Bottom, or After Local Country)
  • Optimized Search based on Country Name (e.g., INDIA), Dial Code (e.g., 91), or Country Code (e.g., IN)
  • Avaiable for Cocoa Pods & Swift package manager
  • Best practices followed

Give it a ⭐️ if it simplifies your app development!

📱 Screenshots

LIGHT & DARK MODE

🤖 Installation

Swift Package Manager

  • File > Swift Packages > Add Package Dependency
  • Add https://github.com/aksamitsah/CountryPickerAKS.git
  • Select Up to Next Major for latest update

CocoaPods

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '12.0'
use_frameworks!

target 'MyApp' do
  pod 'CountryPickerAKS'
end

⛳️ CountryPickerAKS - Docs

Defualt

import CountryPickerAKS

CountryPicker.show(from: self) { result in
   switch result {
       case .success(let data):
       debugPrint(data)
       case .failure(let err):
       debugPrint(err.localizedDescription)
   }
}

A More Advanced Example

With the powerful options, you can accomplish complex tasks with CountryPickerAKS in a simple way. For example, the code below:

  • All the parameters have default values. If you want to override them, just pass the params config updated based on your needs.
  1. Alter Display Elements
  • Case: If at least one parameter is required to display, give an error.
CountryPicker.show(from: self, config: Config(
    display: ShowContent(Flag: true, CountryName: true)
)) { result in
   switch result {
       case .success(let data):
       debugPrint(data)
       case .failure(let err):
       debugPrint(err.localizedDescription)
   }
}
  1. Update Theme
  • Recommendation: If you use dark mode, then pass both appearances.
CountryPicker.show(from: self, config: Config(
    color: ThemeColor(
        primary: .systemGray6,
        secondary: .systemBackground,
        textColor: .systemBlue)
)) { result in
   switch result {
       case .success(let data):
       debugPrint(data)
       case .failure(let err):
       debugPrint(err.localizedDescription)
   }
}
  1. Update Font
CountryPicker.show(from: self, config: Config(
         font: ThemeFont(
                searchBar: UIFont(name: "Lemonada-Medium", size: 16) ?? UIFont(),
                countryName: UIFont(name: "Lemonada-Regular", size: 16) ?? UIFont(),
                countryCode: UIFont(name: "Lemonada-Light", size: 16) ?? UIFont(),
                countryFlag: UIFont(name: "Lemonada-Bold", size: 22) ?? UIFont())
)) { result in
   switch result {
       case .success(let data):
       debugPrint(data)
       case .failure(let err):
       debugPrint(err.localizedDescription)
   }
}
  1. Show/Hide Local Country
CountryPicker.show(from: self, config: Config(
    data: CustomizeCountryList(showLocalOnTop: false)
)) { result in
   switch result {
       case .success(let data):
       debugPrint(data)
       case .failure(let err):
       debugPrint(err.localizedDescription)
   }
}
  1. Add New Country / Alter Position / Display & Remove Only
CountryPicker.show(from: self, config: Config(
    data: CustomizeCountryList(
        addNew: [
            CountryList(name: "New Country", dial_code: "+12", emoji: "🫡", code: "NCA"),
            CountryList(name: "New Country B", dial_code: "+13", emoji: "😵‍💫", code: "NCB")
            ],
        alterExisting: [
            .onTop(["NCA", "NCB"]),
            .onTopAfterLocal(["NP"]),
            .onBottom(["US"])
            ]
    )
)) { result in
   switch result {
       case .success(let data):
       debugPrint(data)
       case .failure(let err):
       debugPrint(err.localizedDescription)
   }
}
  • Use Display Only .displayOnly([code]) Country: Used to display only a list of countries.
  • Use Remove Only .removeOnly([code]) Country: Used to remove a particular country.
CountryPicker.show(from: self, config: Config(
    data: CustomizeCountryList(
        addNew: [
            CountryList(name: "New Country", dial_code: "+12", emoji: "🫡", code: "NCA"),
            CountryList(name: "New Country B", dial_code: "+13", emoji: "😵‍💫", code: "NCB")
            ],
        alterExisting: [
            .onTop(["NCA", "NCB"]),
            .onTopAfterLocal(["NP"]),
            .onBottom(["US"]),
            .displayOnly(["NCA","NCB"]),
            .removeOnly(["NCB"])
            ]
    )
)) { result in
   switch result {
       case .success(let data):
       debugPrint(data)
       case .failure(let err):
       debugPrint(err.localizedDescription)
   }
}

😳 Requirements

  • iOS 11.0+ with support for the latest release, iOS 17
  • Latest Xcode 14.x with Swift
  • Swift v5.0+

🪪 License

MIT © 2023

🔗 Links

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sat Oct 19 2024 22:50:56 GMT-0900 (Hawaii-Aleutian Daylight Time)