Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/exyte/FlagAndCountryCode
- Owner: exyte
- License: mit
- Created: 2023-11-22T11:25:51.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-09T09:31:43.000Z (12 months ago)
- Last Synced: 2024-04-23T20:54:03.814Z (8 months ago)
- Language: Swift
- Size: 1.42 MB
- Stars: 30
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-swift - FlagAndCountryCode - FlagAndCountryCode provides phone codes and flags for every country. Works on UIKit and SwiftUI (Libs / Utility)
- awesome-swift - FlagAndCountryCode - FlagAndCountryCode provides phone codes and flags for every country. Works on UIKit and SwiftUI (Libs / Utility)
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 FlagAndCountryCodelet 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