1
0
Fork 0
mirror of https://github.com/brzzdev/FlagEmojis.git synced 2026-05-16 23:00:26 +00:00
FlagEmojis is a single-file library for matching country code/names to their respective emojis
  • Swift 95.9%
  • Just 3.9%
  • Shell 0.2%
Find a file
renovate[bot] 1e90733040
chore(deps): update dependency nicklockwood/swiftformat to v0.61.1 (#4)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-05-14 21:14:37 +01:00
.github/workflows chore(deps): update dependency macos to v26 (#5) 2026-05-14 20:44:40 +01:00
.scripts chore: add shared tooling and project config 2026-03-30 21:09:53 +01:00
Sources/FlagEmojis style: apply shared swiftformat and swiftlint fixes 2026-03-30 21:10:08 +01:00
Tests/FlagEmojis style: apply shared swiftformat and swiftlint fixes 2026-03-30 21:10:08 +01:00
.git-format-staged chore: add shared tooling and project config 2026-03-30 21:09:53 +01:00
.gitignore build: add SwiftLint configuration 2026-03-30 17:09:16 +01:00
.swiftlint.yml build: add SwiftLint configuration 2026-03-30 17:09:16 +01:00
.swiftlint_child.yml build: add SwiftLint configuration 2026-03-30 17:09:16 +01:00
CLAUDE.md chore: add shared tooling and project config 2026-03-30 21:09:53 +01:00
justfile chore: add shared tooling and project config 2026-03-30 21:09:53 +01:00
Mintfile chore(deps): update dependency nicklockwood/swiftformat to v0.61.1 (#4) 2026-05-14 21:14:37 +01:00
Package.swift style: apply shared swiftformat and swiftlint fixes 2026-03-30 21:10:08 +01:00
README.md FlagEmojis 2025-03-16 00:06:46 +00:00
renovate.json chore: remove assignees from renovate config 2026-04-01 13:22:20 +01:00

FlagEmojis

CI

FlagEmojis is a single-file Swift library for matching country code/names to their respective emojis

API

public static func flag(for country: String) -> String?
public static subscript(country: String) -> String?
public static func countryCode(for country: String) -> String?

Example Usage

FlagEmojis.flag(for: "italy") // 🇮🇹
FlagEmojis["United Kingdom"] // 🇬🇧
FlagEmojis["States"] // nil (Too ambiguous)
FlagEmojis.countryCode(for: "Germany") // DE

Installation

SPM

Targets

  1. From the File menu, select Add Package Dependencies...
  2. Enter "https://github.com/brzzdev/FlagEmojis" into the package repository URL text field

Package.swift

.package(
	url: "https://github.com/brzzdev/FlagEmojis",
	from: "1.0.0"
),

Manual

Add the file to your project, or copy and paste to your hearts desire

Credit

Heavily based on SwiftFlags, which itself credits country-emoji, and flag-emoji-from-country-code 💜