https://github.com/exyte/FlagAndCountryCode
A country code and flag icon provider library for iOS apps
https://github.com/exyte/FlagAndCountryCode
Last synced: 14 days 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 (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-28T08:07:02.000Z (about 2 months ago)
- Last Synced: 2025-03-02T09:40:15.523Z (about 1 month ago)
- Language: Swift
- Size: 1.44 MB
- Stars: 66
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
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://swiftpackageindex.com/exyte/FlagAndCountryCode)
[](https://swiftpackageindex.com/exyte/FlagAndCountryCode)
[](https://swiftpackageindex.com/exyte/FlagAndCountryCode)
[](https://cocoapods.org/pods/FlagAndCountryCode)
[](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 `FlagAndCountryCodeExample.xcodeproj` in the Xcode
- Try it!## Installation
### [Swift Package Manager](https://swift.org/package-manager/)
```swift
dependencies: [
.package(url: "https://github.com/exyte/FlagAndCountryCode.git")
]
```## Requirements
* iOS 15+
* Xcode 15+## Our other open source SwiftUI libraries
[PopupView](https://github.com/exyte/PopupView) - Toasts and popups library
[AnchoredPopup](https://github.com/exyte/AnchoredPopup) - Anchored Popup grows "out" of a trigger view (similar to Hero animation)
[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