Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/exyte/FlagAndCountryCode

A country code and flag icon provider library for iOS apps
https://github.com/exyte/FlagAndCountryCode

Last synced: about 2 months ago
JSON representation

A country code and flag icon provider library for iOS apps

Awesome Lists containing this project

README

        

     













Flag And Country Code

FlagAndCountryCode provides phone codes and flags for every country. Works on UIKit and SwiftUI

![](https://img.shields.io/github/v/tag/exyte/FlagAndCountryCode?label=Version)
[![SPM Compatible](https://img.shields.io/badge/SwiftPM-Compatible-brightgreen.svg)](https://swiftpackageindex.com/exyte/FlagAndCountryCode)
[![Cocoapods Compatible](https://img.shields.io/badge/cocoapods-Compatible-brightgreen.svg)](https://cocoapods.org/pods/FlagAndCountryCode)
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-brightgreen.svg?style=flat)](https://github.com/Carthage/Carthage)
[![License: MIT](https://img.shields.io/badge/License-MIT-black.svg)](https://opensource.org/licenses/MIT)

# Usage
Use the static variable `all` to get the list of `CountryFlagInfo` objects:
```swift
import FlagAndCountryCode

let countries = CountryFlagInfo.all
```

Each `CountryFlagInfo` contains:
`name` - name of the country ("United States")
`code` - 2 letter country code ("US")
`dialCode` - dial code ("+1")
`languageNative` - original name of the language ("Español")
`languageEnglish` - name of the language in English ("Spanish")

Use `getCountryImage` on a `CountryFlagInfo` of choice. It has both UIKit and SwiftUI implementations, returning a `UIImage` and a `View` respectively. Pass your desired flag style as a parameter.
```swift
country.getCountryImage(with: .roundedRect)
```

### Available flag types
`roundedRect` - 21 x 15 with rounded corners
`square` - 15 x 15 with rounded corners
`circle` - 15 x 15

## Examples

To try the FlagAndCountryCode examples:
- Clone the repo `https://github.com/exyte/FlagAndCountryCode.git`
- Open Example/Example.xcodeproj
- Try it!

## Installation

### [Swift Package Manager](https://swift.org/package-manager/)

```swift
dependencies: [
.package(url: "https://github.com/exyte/FlagAndCountryCode.git")
]
```

### [CocoaPods](http://cocoapods.org)

To install `FlagAndCountryCode`, simply add the following line to your Podfile:

```ruby
pod 'FlagAndCountryCode'
```

### [Carthage](http://github.com/Carthage/Carthage)

To integrate `FlagAndCountryCode` into your Xcode project using Carthage, specify it in your `Cartfile`

```ogdl
github "Exyte/FlagAndCountryCode"
```

## Requirements

* iOS 15+
* Xcode 15+

## Our other open source SwiftUI libraries
[PopupView](https://github.com/exyte/PopupView) - Toasts and popups library
[Grid](https://github.com/exyte/Grid) - The most powerful Grid container
[ScalingHeaderScrollView](https://github.com/exyte/ScalingHeaderScrollView) - A scroll view with a sticky header which shrinks as you scroll
[AnimatedTabBar](https://github.com/exyte/AnimatedTabBar) - A tabbar with a number of preset animations
[MediaPicker](https://github.com/exyte/mediapicker) - Customizable media picker
[Chat](https://github.com/exyte/chat) - Chat UI framework with fully customizable message cells, input view, and a built-in media picker
[OpenAI](https://github.com/exyte/OpenAI) Wrapper lib for [OpenAI REST API](https://platform.openai.com/docs/api-reference/introduction)
[AnimatedGradient](https://github.com/exyte/AnimatedGradient) - Animated linear gradient
[ConcentricOnboarding](https://github.com/exyte/ConcentricOnboarding) - Animated onboarding flow
[FloatingButton](https://github.com/exyte/FloatingButton) - Floating button menu
[ActivityIndicatorView](https://github.com/exyte/ActivityIndicatorView) - A number of animated loading indicators
[ProgressIndicatorView](https://github.com/exyte/ProgressIndicatorView) - A number of animated progress indicators
[SVGView](https://github.com/exyte/SVGView) - SVG parser
[LiquidSwipe](https://github.com/exyte/LiquidSwipe) - Liquid navigation animation