Skip to content

tatsuz0u/FairFlag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FairFlag

A SwiftUI country flag package built to mitigate Taiwan flag censorship issues.

BitRemote app icon.

Background

On China-model iPhone and iPad devices, the Taiwan flag emoji may not render correctly. To keep behavior consistent for those cases, FairFlag uses a fixed rule for TW.

  • On iOS and iPadOS, when the country code is TW, FairFlag always uses the bundled ROC image asset.
  • For all other country codes, FairFlag keeps normal emoji-based rendering.

Features

  • Convert ISO country codes to flag emoji (String.toFlagEmoji()).
  • Render an emoji string as a SwiftUI Image (FairFlag.image(emoji:)).
  • Render a country code as a SwiftUI Image (FairFlag.image(countryCode:)).

Requirements

  • Swift 5.3+
  • iOS 13.0+
  • iPadOS 13.0+
  • watchOS 6.0+
  • tvOS 13.0+
  • macOS 10.15+
  • visionOS 1.0+

Usage

Add FairFlag to your Package.swift:

.package(url: "https://github.com/tatsuz0u/FairFlag", from: "1.0.0")

In a SwiftUI view:

import FairFlag
  
let emoji = "TW".toFlagEmoji()

let countryCodeImage =
FairFlag.image(countryCode: "TW")?
  .resizable()
  .frame(width: 20, height: 20)

let emojiImage = FairFlag.image(emoji: "🇹🇼")

About

A SwiftUI country flag package built to mitigate Taiwan flag censorship issues.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages