├── .gitignore
├── LICENSE
├── Package.swift
├── README.md
├── SampleApp
├── SwiftFlags-Tests
│ └── Info.plist
├── SwiftFlags-iOS
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ └── Contents.json
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── FlagsViewController.swift
│ ├── Info.plist
│ └── SceneDelegate.swift
├── SwiftFlags.xcodeproj
│ ├── project.pbxproj
│ └── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
└── SwiftFlags
│ ├── Info.plist
│ └── SwiftFlags.h
├── Sources
└── SwiftFlags
│ └── SwiftFlags.swift
├── SwiftFlags.podspec
└── Tests
├── LinuxMain.swift
└── SwiftFlagsTests
├── SwiftFlagsTests.swift
└── XCTestManifests.swift
/.gitignore:
--------------------------------------------------------------------------------
1 | xcuserdata/
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Andrea Busi
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/Package.swift:
--------------------------------------------------------------------------------
1 | // swift-tools-version:5.2
2 | // The swift-tools-version declares the minimum version of Swift required to build this package.
3 |
4 | import PackageDescription
5 |
6 | let package = Package(
7 | name: "SwiftFlags",
8 | platforms: [
9 | .macOS(.v10_12),
10 | .iOS(.v10),
11 | .tvOS(.v10),
12 | .watchOS(.v3)
13 | ],
14 | products: [
15 | .library(
16 | name: "SwiftFlags",
17 | targets: ["SwiftFlags"]),
18 | ],
19 | dependencies: [],
20 | targets: [
21 | .target(
22 | name: "SwiftFlags",
23 | dependencies: []),
24 | .testTarget(
25 | name: "SwiftFlagsTests",
26 | dependencies: ["SwiftFlags"]),
27 | ],
28 | swiftLanguageVersions: [.v5]
29 | )
30 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SwiftFlags
2 |
3 | 
4 | [](https://github.com/BubiDevs/SwiftFlags)
5 | [](https://github.com/BubiDevs/SwiftFlags)
6 |
7 |
8 | SwiftFlags is a simple library to get emoji flag from a country name or a country code (ISO 3166-1).
9 |
10 | ## Usage
11 |
12 | SwiftFlags comes with some static methods that you can use:
13 |
14 | ```swift
15 | class func flag(for country: String) -> String?
16 | ```
17 |
18 | ```swift
19 | class func countryCode(for country: String) -> String?
20 | ```
21 |
22 | ## Examples
23 |
24 | Here are some examples to get the emoji flag for a country. You can pass both a country name or a country code:
25 |
26 | ```swift
27 | // Returns 🇮🇹
28 | let _ = SwiftFlags.flag(for: "italy")
29 | // Returns 🇺🇸
30 | let _ = SwiftFlags.flag(for: "United States")
31 | // Returns nil
32 | let _ = SwiftFlags.flag(for: "England")
33 | // Returns 🇯🇵
34 | let _ = SwiftFlags.flag(for: "JP")
35 | // Returns 🇰🇷
36 | let _ = SwiftFlags.flag(for: "Korea, South")
37 | ```
38 |
39 | SwiftFlags also provide the ability to return the ISO country code for a given country:
40 |
41 | ```swift
42 | // Returns 'IT'
43 | let _ = SwiftFlags.countryCode(for: "italy")
44 | // Returns 'US'
45 | let _ = SwiftFlags.countryCode(for: "United States")
46 | // Returns nil
47 | let _ = SwiftFlags.countryCode(for: "England")
48 | ```
49 |
50 | ## Requirements
51 |
52 | The latest version of SwiftFlags require:
53 |
54 | * Swift 5
55 | * XCode 11+ (in order to use Swift Package Manager)
56 |
57 | ## Installation
58 |
59 | SwiftFlags is available via CocoaPods, Swift Package Manager or you can directly embeed the library inside your project.
60 |
61 | ### CocoaPods
62 |
63 | Add the following to your Podfile:
64 |
65 | `pod 'SwiftFlags'`
66 |
67 | ### Swift Package Manager
68 |
69 | Add the repo URL using the Swift Package Manager built inside Xcode:
70 |
71 | `https://github.com/BubiDevs/SwiftFlags.git`
72 |
73 | ### Manual installation
74 |
75 | Just drag and drop the files under the `Sources` folder inside your project.
76 |
77 | ## Credits
78 |
79 | This library is based on the work of two existing library:
80 |
81 | * [country-emoji](https://github.com/meeDamian/country-emoji/blob/master/src/lib.js), available for JavaScript
82 | * [flag-emoji-from-country-code](https://github.com/bendodson/flag-emoji-from-country-code), a great snippet to get the emoji flag from an ISO 3166-1 region code
83 |
84 | Thanks guys for your work!
85 |
86 | ## ToDo
87 |
88 | * [x] Add Swift Package Manager support
89 | * [x] Improve ObjC interoperability
90 |
--------------------------------------------------------------------------------
/SampleApp/SwiftFlags-Tests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/SampleApp/SwiftFlags-iOS/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // SwiftFlags-iOS
4 | //
5 | // Created by Busi Andrea on 25/04/2020.
6 | // Copyright © 2020 BubiDevs. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 |
15 |
16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
17 | // Override point for customization after application launch.
18 | return true
19 | }
20 |
21 | // MARK: UISceneSession Lifecycle
22 |
23 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
24 | // Called when a new scene session is being created.
25 | // Use this method to select a configuration to create the new scene with.
26 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
27 | }
28 |
29 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) {
30 | // Called when the user discards a scene session.
31 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
32 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
33 | }
34 |
35 |
36 | }
37 |
38 |
--------------------------------------------------------------------------------
/SampleApp/SwiftFlags-iOS/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "scale" : "2x",
6 | "size" : "20x20"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "scale" : "3x",
11 | "size" : "20x20"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "scale" : "2x",
16 | "size" : "29x29"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "scale" : "3x",
21 | "size" : "29x29"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "scale" : "2x",
26 | "size" : "40x40"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "scale" : "3x",
31 | "size" : "40x40"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "scale" : "2x",
36 | "size" : "60x60"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "scale" : "3x",
41 | "size" : "60x60"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "scale" : "1x",
46 | "size" : "20x20"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "scale" : "2x",
51 | "size" : "20x20"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "scale" : "1x",
56 | "size" : "29x29"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "scale" : "2x",
61 | "size" : "29x29"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "scale" : "1x",
66 | "size" : "40x40"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "scale" : "2x",
71 | "size" : "40x40"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "scale" : "1x",
76 | "size" : "76x76"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "scale" : "2x",
81 | "size" : "76x76"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "scale" : "2x",
86 | "size" : "83.5x83.5"
87 | },
88 | {
89 | "idiom" : "ios-marketing",
90 | "scale" : "1x",
91 | "size" : "1024x1024"
92 | }
93 | ],
94 | "info" : {
95 | "author" : "xcode",
96 | "version" : 1
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/SampleApp/SwiftFlags-iOS/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/SampleApp/SwiftFlags-iOS/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/SampleApp/SwiftFlags-iOS/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
32 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/SampleApp/SwiftFlags-iOS/FlagsViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FlagsViewController.swift
3 | // SwiftFlags-iOS
4 | //
5 | // Created by Busi Andrea on 25/04/2020.
6 | // Copyright © 2020 BubiDevs. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import SwiftFlags
11 |
12 | class FlagsViewController: UITableViewController {
13 |
14 | private let countries = ["it", "japan", "united states", "england", "iran", "united", "russia"]
15 |
16 | // MARK: - View Lifecycle
17 |
18 | override func viewDidLoad() {
19 | super.viewDidLoad()
20 |
21 | title = "SwiftFlags"
22 | }
23 |
24 | // MARK: - Table view data source
25 |
26 | override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
27 | return countries.count
28 | }
29 |
30 | override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
31 | let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
32 |
33 | let country = countries[indexPath.row]
34 | if let flag = SwiftFlags.flag(for: country) {
35 | cell.textLabel?.text = "\(flag) \(country.capitalized)"
36 | cell.detailTextLabel?.text = nil
37 | } else {
38 | cell.textLabel?.text = "\(country)"
39 | cell.detailTextLabel?.text = "No flag available"
40 | }
41 | return cell
42 | }
43 | }
44 |
45 |
--------------------------------------------------------------------------------
/SampleApp/SwiftFlags-iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UIApplicationSceneManifest
24 |
25 | UIApplicationSupportsMultipleScenes
26 |
27 | UISceneConfigurations
28 |
29 | UIWindowSceneSessionRoleApplication
30 |
31 |
32 | UISceneConfigurationName
33 | Default Configuration
34 | UISceneDelegateClassName
35 | $(PRODUCT_MODULE_NAME).SceneDelegate
36 | UISceneStoryboardFile
37 | Main
38 |
39 |
40 |
41 |
42 | UILaunchStoryboardName
43 | LaunchScreen
44 | UIMainStoryboardFile
45 | Main
46 | UIRequiredDeviceCapabilities
47 |
48 | armv7
49 |
50 | UISupportedInterfaceOrientations
51 |
52 | UIInterfaceOrientationPortrait
53 | UIInterfaceOrientationLandscapeLeft
54 | UIInterfaceOrientationLandscapeRight
55 |
56 | UISupportedInterfaceOrientations~ipad
57 |
58 | UIInterfaceOrientationPortrait
59 | UIInterfaceOrientationPortraitUpsideDown
60 | UIInterfaceOrientationLandscapeLeft
61 | UIInterfaceOrientationLandscapeRight
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/SampleApp/SwiftFlags-iOS/SceneDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SceneDelegate.swift
3 | // SwiftFlags-iOS
4 | //
5 | // Created by Busi Andrea on 25/04/2020.
6 | // Copyright © 2020 BubiDevs. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class SceneDelegate: UIResponder, UIWindowSceneDelegate {
12 |
13 | var window: UIWindow?
14 |
15 |
16 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
17 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
18 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
19 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
20 | guard let _ = (scene as? UIWindowScene) else { return }
21 | }
22 |
23 | func sceneDidDisconnect(_ scene: UIScene) {
24 | // Called as the scene is being released by the system.
25 | // This occurs shortly after the scene enters the background, or when its session is discarded.
26 | // Release any resources associated with this scene that can be re-created the next time the scene connects.
27 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
28 | }
29 |
30 | func sceneDidBecomeActive(_ scene: UIScene) {
31 | // Called when the scene has moved from an inactive state to an active state.
32 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
33 | }
34 |
35 | func sceneWillResignActive(_ scene: UIScene) {
36 | // Called when the scene will move from an active state to an inactive state.
37 | // This may occur due to temporary interruptions (ex. an incoming phone call).
38 | }
39 |
40 | func sceneWillEnterForeground(_ scene: UIScene) {
41 | // Called as the scene transitions from the background to the foreground.
42 | // Use this method to undo the changes made on entering the background.
43 | }
44 |
45 | func sceneDidEnterBackground(_ scene: UIScene) {
46 | // Called as the scene transitions from the foreground to the background.
47 | // Use this method to save data, release shared resources, and store enough scene-specific state information
48 | // to restore the scene back to its current state.
49 | }
50 |
51 |
52 | }
53 |
54 |
--------------------------------------------------------------------------------
/SampleApp/SwiftFlags.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 50;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | DCA2C844245B06A3002534BC /* SwiftFlags.podspec in Resources */ = {isa = PBXBuildFile; fileRef = DCA2C843245B06A3002534BC /* SwiftFlags.podspec */; };
11 | DCC5719724549F0700692503 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCC5719624549F0700692503 /* AppDelegate.swift */; };
12 | DCC5719924549F0700692503 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCC5719824549F0700692503 /* SceneDelegate.swift */; };
13 | DCC5719B24549F0700692503 /* FlagsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCC5719A24549F0700692503 /* FlagsViewController.swift */; };
14 | DCC5719E24549F0700692503 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DCC5719C24549F0700692503 /* Main.storyboard */; };
15 | DCC571A024549F0800692503 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DCC5719F24549F0800692503 /* Assets.xcassets */; };
16 | DCC571A324549F0800692503 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DCC571A124549F0800692503 /* LaunchScreen.storyboard */; };
17 | DCC571B124549F2B00692503 /* SwiftFlags.h in Headers */ = {isa = PBXBuildFile; fileRef = DCC571AF24549F2B00692503 /* SwiftFlags.h */; settings = {ATTRIBUTES = (Public, ); }; };
18 | DCC571B624549F3B00692503 /* SwiftFlags.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCC571AD24549F2B00692503 /* SwiftFlags.framework */; };
19 | DCC571B724549F3B00692503 /* SwiftFlags.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DCC571AD24549F2B00692503 /* SwiftFlags.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20 | DCC571BC24549F5200692503 /* SwiftFlags.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCC571BB24549F5200692503 /* SwiftFlags.swift */; };
21 | DCCD77902454A20D00CCC426 /* XCTestManifests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCCD778E2454A20D00CCC426 /* XCTestManifests.swift */; };
22 | DCCD77912454A20D00CCC426 /* SwiftFlagsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCCD778F2454A20D00CCC426 /* SwiftFlagsTests.swift */; };
23 | /* End PBXBuildFile section */
24 |
25 | /* Begin PBXContainerItemProxy section */
26 | DCC571B824549F3B00692503 /* PBXContainerItemProxy */ = {
27 | isa = PBXContainerItemProxy;
28 | containerPortal = DC6193CC2454717C00845FC7 /* Project object */;
29 | proxyType = 1;
30 | remoteGlobalIDString = DCC571AC24549F2B00692503;
31 | remoteInfo = SwiftFlags;
32 | };
33 | /* End PBXContainerItemProxy section */
34 |
35 | /* Begin PBXCopyFilesBuildPhase section */
36 | DCC571BA24549F3B00692503 /* Embed Frameworks */ = {
37 | isa = PBXCopyFilesBuildPhase;
38 | buildActionMask = 2147483647;
39 | dstPath = "";
40 | dstSubfolderSpec = 10;
41 | files = (
42 | DCC571B724549F3B00692503 /* SwiftFlags.framework in Embed Frameworks */,
43 | );
44 | name = "Embed Frameworks";
45 | runOnlyForDeploymentPostprocessing = 0;
46 | };
47 | /* End PBXCopyFilesBuildPhase section */
48 |
49 | /* Begin PBXFileReference section */
50 | DCA2C843245B06A3002534BC /* SwiftFlags.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = SwiftFlags.podspec; path = ../SwiftFlags.podspec; sourceTree = ""; };
51 | DCC5719424549F0700692503 /* SwiftFlags-iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "SwiftFlags-iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
52 | DCC5719624549F0700692503 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
53 | DCC5719824549F0700692503 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; };
54 | DCC5719A24549F0700692503 /* FlagsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlagsViewController.swift; sourceTree = ""; };
55 | DCC5719D24549F0700692503 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
56 | DCC5719F24549F0800692503 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
57 | DCC571A224549F0800692503 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
58 | DCC571A424549F0800692503 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
59 | DCC571AD24549F2B00692503 /* SwiftFlags.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftFlags.framework; sourceTree = BUILT_PRODUCTS_DIR; };
60 | DCC571AF24549F2B00692503 /* SwiftFlags.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SwiftFlags.h; sourceTree = ""; };
61 | DCC571B024549F2B00692503 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
62 | DCC571BB24549F5200692503 /* SwiftFlags.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SwiftFlags.swift; path = ../../Sources/SwiftFlags/SwiftFlags.swift; sourceTree = ""; };
63 | DCCD77862454A1B500CCC426 /* SwiftFlags-Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SwiftFlags-Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
64 | DCCD778A2454A1B500CCC426 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
65 | DCCD778E2454A20D00CCC426 /* XCTestManifests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = XCTestManifests.swift; path = ../../Tests/SwiftFlagsTests/XCTestManifests.swift; sourceTree = ""; };
66 | DCCD778F2454A20D00CCC426 /* SwiftFlagsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SwiftFlagsTests.swift; path = ../../Tests/SwiftFlagsTests/SwiftFlagsTests.swift; sourceTree = ""; };
67 | /* End PBXFileReference section */
68 |
69 | /* Begin PBXFrameworksBuildPhase section */
70 | DCC5719124549F0700692503 /* Frameworks */ = {
71 | isa = PBXFrameworksBuildPhase;
72 | buildActionMask = 2147483647;
73 | files = (
74 | DCC571B624549F3B00692503 /* SwiftFlags.framework in Frameworks */,
75 | );
76 | runOnlyForDeploymentPostprocessing = 0;
77 | };
78 | DCC571AA24549F2B00692503 /* Frameworks */ = {
79 | isa = PBXFrameworksBuildPhase;
80 | buildActionMask = 2147483647;
81 | files = (
82 | );
83 | runOnlyForDeploymentPostprocessing = 0;
84 | };
85 | DCCD77832454A1B500CCC426 /* Frameworks */ = {
86 | isa = PBXFrameworksBuildPhase;
87 | buildActionMask = 2147483647;
88 | files = (
89 | );
90 | runOnlyForDeploymentPostprocessing = 0;
91 | };
92 | /* End PBXFrameworksBuildPhase section */
93 |
94 | /* Begin PBXGroup section */
95 | DC6193CB2454717C00845FC7 = {
96 | isa = PBXGroup;
97 | children = (
98 | DCA2C843245B06A3002534BC /* SwiftFlags.podspec */,
99 | DCC571AE24549F2B00692503 /* SwiftFlags */,
100 | DCC5719524549F0700692503 /* SwiftFlags-iOS */,
101 | DCCD77872454A1B500CCC426 /* SwiftFlags-Tests */,
102 | DC6193D52454717C00845FC7 /* Products */,
103 | DCC571B524549F3B00692503 /* Frameworks */,
104 | );
105 | sourceTree = "";
106 | };
107 | DC6193D52454717C00845FC7 /* Products */ = {
108 | isa = PBXGroup;
109 | children = (
110 | DCC5719424549F0700692503 /* SwiftFlags-iOS.app */,
111 | DCC571AD24549F2B00692503 /* SwiftFlags.framework */,
112 | DCCD77862454A1B500CCC426 /* SwiftFlags-Tests.xctest */,
113 | );
114 | name = Products;
115 | sourceTree = "";
116 | };
117 | DCC5719524549F0700692503 /* SwiftFlags-iOS */ = {
118 | isa = PBXGroup;
119 | children = (
120 | DCC5719624549F0700692503 /* AppDelegate.swift */,
121 | DCC5719824549F0700692503 /* SceneDelegate.swift */,
122 | DCC5719A24549F0700692503 /* FlagsViewController.swift */,
123 | DCC5719C24549F0700692503 /* Main.storyboard */,
124 | DCC5719F24549F0800692503 /* Assets.xcassets */,
125 | DCC571A124549F0800692503 /* LaunchScreen.storyboard */,
126 | DCC571A424549F0800692503 /* Info.plist */,
127 | );
128 | path = "SwiftFlags-iOS";
129 | sourceTree = "";
130 | };
131 | DCC571AE24549F2B00692503 /* SwiftFlags */ = {
132 | isa = PBXGroup;
133 | children = (
134 | DCC571BB24549F5200692503 /* SwiftFlags.swift */,
135 | DCC571AF24549F2B00692503 /* SwiftFlags.h */,
136 | DCC571B024549F2B00692503 /* Info.plist */,
137 | );
138 | path = SwiftFlags;
139 | sourceTree = "";
140 | };
141 | DCC571B524549F3B00692503 /* Frameworks */ = {
142 | isa = PBXGroup;
143 | children = (
144 | );
145 | name = Frameworks;
146 | sourceTree = "";
147 | };
148 | DCCD77872454A1B500CCC426 /* SwiftFlags-Tests */ = {
149 | isa = PBXGroup;
150 | children = (
151 | DCCD778F2454A20D00CCC426 /* SwiftFlagsTests.swift */,
152 | DCCD778E2454A20D00CCC426 /* XCTestManifests.swift */,
153 | DCCD778A2454A1B500CCC426 /* Info.plist */,
154 | );
155 | path = "SwiftFlags-Tests";
156 | sourceTree = "";
157 | };
158 | /* End PBXGroup section */
159 |
160 | /* Begin PBXHeadersBuildPhase section */
161 | DCC571A824549F2B00692503 /* Headers */ = {
162 | isa = PBXHeadersBuildPhase;
163 | buildActionMask = 2147483647;
164 | files = (
165 | DCC571B124549F2B00692503 /* SwiftFlags.h in Headers */,
166 | );
167 | runOnlyForDeploymentPostprocessing = 0;
168 | };
169 | /* End PBXHeadersBuildPhase section */
170 |
171 | /* Begin PBXNativeTarget section */
172 | DCC5719324549F0700692503 /* SwiftFlags-iOS */ = {
173 | isa = PBXNativeTarget;
174 | buildConfigurationList = DCC571A524549F0800692503 /* Build configuration list for PBXNativeTarget "SwiftFlags-iOS" */;
175 | buildPhases = (
176 | DCC5719024549F0700692503 /* Sources */,
177 | DCC5719124549F0700692503 /* Frameworks */,
178 | DCC5719224549F0700692503 /* Resources */,
179 | DCC571BA24549F3B00692503 /* Embed Frameworks */,
180 | );
181 | buildRules = (
182 | );
183 | dependencies = (
184 | DCC571B924549F3B00692503 /* PBXTargetDependency */,
185 | );
186 | name = "SwiftFlags-iOS";
187 | productName = "SwiftFlags-iOS";
188 | productReference = DCC5719424549F0700692503 /* SwiftFlags-iOS.app */;
189 | productType = "com.apple.product-type.application";
190 | };
191 | DCC571AC24549F2B00692503 /* SwiftFlags */ = {
192 | isa = PBXNativeTarget;
193 | buildConfigurationList = DCC571B224549F2B00692503 /* Build configuration list for PBXNativeTarget "SwiftFlags" */;
194 | buildPhases = (
195 | DCC571A824549F2B00692503 /* Headers */,
196 | DCC571A924549F2B00692503 /* Sources */,
197 | DCC571AA24549F2B00692503 /* Frameworks */,
198 | DCC571AB24549F2B00692503 /* Resources */,
199 | );
200 | buildRules = (
201 | );
202 | dependencies = (
203 | );
204 | name = SwiftFlags;
205 | productName = SwiftFlags;
206 | productReference = DCC571AD24549F2B00692503 /* SwiftFlags.framework */;
207 | productType = "com.apple.product-type.framework";
208 | };
209 | DCCD77852454A1B500CCC426 /* SwiftFlags-Tests */ = {
210 | isa = PBXNativeTarget;
211 | buildConfigurationList = DCCD778D2454A1B500CCC426 /* Build configuration list for PBXNativeTarget "SwiftFlags-Tests" */;
212 | buildPhases = (
213 | DCCD77822454A1B500CCC426 /* Sources */,
214 | DCCD77832454A1B500CCC426 /* Frameworks */,
215 | DCCD77842454A1B500CCC426 /* Resources */,
216 | );
217 | buildRules = (
218 | );
219 | dependencies = (
220 | );
221 | name = "SwiftFlags-Tests";
222 | productName = "SwiftFlags-Tests";
223 | productReference = DCCD77862454A1B500CCC426 /* SwiftFlags-Tests.xctest */;
224 | productType = "com.apple.product-type.bundle.unit-test";
225 | };
226 | /* End PBXNativeTarget section */
227 |
228 | /* Begin PBXProject section */
229 | DC6193CC2454717C00845FC7 /* Project object */ = {
230 | isa = PBXProject;
231 | attributes = {
232 | LastSwiftUpdateCheck = 1140;
233 | LastUpgradeCheck = 1140;
234 | ORGANIZATIONNAME = BubiDevs;
235 | TargetAttributes = {
236 | DCC5719324549F0700692503 = {
237 | CreatedOnToolsVersion = 11.4.1;
238 | };
239 | DCC571AC24549F2B00692503 = {
240 | CreatedOnToolsVersion = 11.4.1;
241 | LastSwiftMigration = 1140;
242 | };
243 | DCCD77852454A1B500CCC426 = {
244 | CreatedOnToolsVersion = 11.4.1;
245 | };
246 | };
247 | };
248 | buildConfigurationList = DC6193CF2454717C00845FC7 /* Build configuration list for PBXProject "SwiftFlags" */;
249 | compatibilityVersion = "Xcode 9.3";
250 | developmentRegion = en;
251 | hasScannedForEncodings = 0;
252 | knownRegions = (
253 | en,
254 | Base,
255 | );
256 | mainGroup = DC6193CB2454717C00845FC7;
257 | productRefGroup = DC6193D52454717C00845FC7 /* Products */;
258 | projectDirPath = "";
259 | projectRoot = "";
260 | targets = (
261 | DCC571AC24549F2B00692503 /* SwiftFlags */,
262 | DCC5719324549F0700692503 /* SwiftFlags-iOS */,
263 | DCCD77852454A1B500CCC426 /* SwiftFlags-Tests */,
264 | );
265 | };
266 | /* End PBXProject section */
267 |
268 | /* Begin PBXResourcesBuildPhase section */
269 | DCC5719224549F0700692503 /* Resources */ = {
270 | isa = PBXResourcesBuildPhase;
271 | buildActionMask = 2147483647;
272 | files = (
273 | DCC571A324549F0800692503 /* LaunchScreen.storyboard in Resources */,
274 | DCC571A024549F0800692503 /* Assets.xcassets in Resources */,
275 | DCC5719E24549F0700692503 /* Main.storyboard in Resources */,
276 | );
277 | runOnlyForDeploymentPostprocessing = 0;
278 | };
279 | DCC571AB24549F2B00692503 /* Resources */ = {
280 | isa = PBXResourcesBuildPhase;
281 | buildActionMask = 2147483647;
282 | files = (
283 | DCA2C844245B06A3002534BC /* SwiftFlags.podspec in Resources */,
284 | );
285 | runOnlyForDeploymentPostprocessing = 0;
286 | };
287 | DCCD77842454A1B500CCC426 /* Resources */ = {
288 | isa = PBXResourcesBuildPhase;
289 | buildActionMask = 2147483647;
290 | files = (
291 | );
292 | runOnlyForDeploymentPostprocessing = 0;
293 | };
294 | /* End PBXResourcesBuildPhase section */
295 |
296 | /* Begin PBXSourcesBuildPhase section */
297 | DCC5719024549F0700692503 /* Sources */ = {
298 | isa = PBXSourcesBuildPhase;
299 | buildActionMask = 2147483647;
300 | files = (
301 | DCC5719B24549F0700692503 /* FlagsViewController.swift in Sources */,
302 | DCC5719724549F0700692503 /* AppDelegate.swift in Sources */,
303 | DCC5719924549F0700692503 /* SceneDelegate.swift in Sources */,
304 | );
305 | runOnlyForDeploymentPostprocessing = 0;
306 | };
307 | DCC571A924549F2B00692503 /* Sources */ = {
308 | isa = PBXSourcesBuildPhase;
309 | buildActionMask = 2147483647;
310 | files = (
311 | DCC571BC24549F5200692503 /* SwiftFlags.swift in Sources */,
312 | );
313 | runOnlyForDeploymentPostprocessing = 0;
314 | };
315 | DCCD77822454A1B500CCC426 /* Sources */ = {
316 | isa = PBXSourcesBuildPhase;
317 | buildActionMask = 2147483647;
318 | files = (
319 | DCCD77902454A20D00CCC426 /* XCTestManifests.swift in Sources */,
320 | DCCD77912454A20D00CCC426 /* SwiftFlagsTests.swift in Sources */,
321 | );
322 | runOnlyForDeploymentPostprocessing = 0;
323 | };
324 | /* End PBXSourcesBuildPhase section */
325 |
326 | /* Begin PBXTargetDependency section */
327 | DCC571B924549F3B00692503 /* PBXTargetDependency */ = {
328 | isa = PBXTargetDependency;
329 | target = DCC571AC24549F2B00692503 /* SwiftFlags */;
330 | targetProxy = DCC571B824549F3B00692503 /* PBXContainerItemProxy */;
331 | };
332 | /* End PBXTargetDependency section */
333 |
334 | /* Begin PBXVariantGroup section */
335 | DCC5719C24549F0700692503 /* Main.storyboard */ = {
336 | isa = PBXVariantGroup;
337 | children = (
338 | DCC5719D24549F0700692503 /* Base */,
339 | );
340 | name = Main.storyboard;
341 | sourceTree = "";
342 | };
343 | DCC571A124549F0800692503 /* LaunchScreen.storyboard */ = {
344 | isa = PBXVariantGroup;
345 | children = (
346 | DCC571A224549F0800692503 /* Base */,
347 | );
348 | name = LaunchScreen.storyboard;
349 | sourceTree = "";
350 | };
351 | /* End PBXVariantGroup section */
352 |
353 | /* Begin XCBuildConfiguration section */
354 | DC6193E62454718000845FC7 /* Debug */ = {
355 | isa = XCBuildConfiguration;
356 | buildSettings = {
357 | ALWAYS_SEARCH_USER_PATHS = NO;
358 | CLANG_ANALYZER_NONNULL = YES;
359 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
360 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
361 | CLANG_CXX_LIBRARY = "libc++";
362 | CLANG_ENABLE_MODULES = YES;
363 | CLANG_ENABLE_OBJC_ARC = YES;
364 | CLANG_ENABLE_OBJC_WEAK = YES;
365 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
366 | CLANG_WARN_BOOL_CONVERSION = YES;
367 | CLANG_WARN_COMMA = YES;
368 | CLANG_WARN_CONSTANT_CONVERSION = YES;
369 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
370 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
371 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
372 | CLANG_WARN_EMPTY_BODY = YES;
373 | CLANG_WARN_ENUM_CONVERSION = YES;
374 | CLANG_WARN_INFINITE_RECURSION = YES;
375 | CLANG_WARN_INT_CONVERSION = YES;
376 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
377 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
378 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
379 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
380 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
381 | CLANG_WARN_STRICT_PROTOTYPES = YES;
382 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
383 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
384 | CLANG_WARN_UNREACHABLE_CODE = YES;
385 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
386 | COPY_PHASE_STRIP = NO;
387 | DEBUG_INFORMATION_FORMAT = dwarf;
388 | ENABLE_STRICT_OBJC_MSGSEND = YES;
389 | ENABLE_TESTABILITY = YES;
390 | GCC_C_LANGUAGE_STANDARD = gnu11;
391 | GCC_DYNAMIC_NO_PIC = NO;
392 | GCC_NO_COMMON_BLOCKS = YES;
393 | GCC_OPTIMIZATION_LEVEL = 0;
394 | GCC_PREPROCESSOR_DEFINITIONS = (
395 | "DEBUG=1",
396 | "$(inherited)",
397 | );
398 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
399 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
400 | GCC_WARN_UNDECLARED_SELECTOR = YES;
401 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
402 | GCC_WARN_UNUSED_FUNCTION = YES;
403 | GCC_WARN_UNUSED_VARIABLE = YES;
404 | IPHONEOS_DEPLOYMENT_TARGET = 13.0;
405 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
406 | MTL_FAST_MATH = YES;
407 | ONLY_ACTIVE_ARCH = YES;
408 | SDKROOT = iphoneos;
409 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
410 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
411 | };
412 | name = Debug;
413 | };
414 | DC6193E72454718000845FC7 /* Release */ = {
415 | isa = XCBuildConfiguration;
416 | buildSettings = {
417 | ALWAYS_SEARCH_USER_PATHS = NO;
418 | CLANG_ANALYZER_NONNULL = YES;
419 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
420 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
421 | CLANG_CXX_LIBRARY = "libc++";
422 | CLANG_ENABLE_MODULES = YES;
423 | CLANG_ENABLE_OBJC_ARC = YES;
424 | CLANG_ENABLE_OBJC_WEAK = YES;
425 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
426 | CLANG_WARN_BOOL_CONVERSION = YES;
427 | CLANG_WARN_COMMA = YES;
428 | CLANG_WARN_CONSTANT_CONVERSION = YES;
429 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
430 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
431 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
432 | CLANG_WARN_EMPTY_BODY = YES;
433 | CLANG_WARN_ENUM_CONVERSION = YES;
434 | CLANG_WARN_INFINITE_RECURSION = YES;
435 | CLANG_WARN_INT_CONVERSION = YES;
436 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
437 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
438 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
439 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
440 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
441 | CLANG_WARN_STRICT_PROTOTYPES = YES;
442 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
443 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
444 | CLANG_WARN_UNREACHABLE_CODE = YES;
445 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
446 | COPY_PHASE_STRIP = NO;
447 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
448 | ENABLE_NS_ASSERTIONS = NO;
449 | ENABLE_STRICT_OBJC_MSGSEND = YES;
450 | GCC_C_LANGUAGE_STANDARD = gnu11;
451 | GCC_NO_COMMON_BLOCKS = YES;
452 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
453 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
454 | GCC_WARN_UNDECLARED_SELECTOR = YES;
455 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
456 | GCC_WARN_UNUSED_FUNCTION = YES;
457 | GCC_WARN_UNUSED_VARIABLE = YES;
458 | IPHONEOS_DEPLOYMENT_TARGET = 13.0;
459 | MTL_ENABLE_DEBUG_INFO = NO;
460 | MTL_FAST_MATH = YES;
461 | SDKROOT = iphoneos;
462 | SWIFT_COMPILATION_MODE = wholemodule;
463 | SWIFT_OPTIMIZATION_LEVEL = "-O";
464 | VALIDATE_PRODUCT = YES;
465 | };
466 | name = Release;
467 | };
468 | DCC571A624549F0800692503 /* Debug */ = {
469 | isa = XCBuildConfiguration;
470 | buildSettings = {
471 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
472 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
473 | CODE_SIGN_STYLE = Automatic;
474 | DEVELOPMENT_TEAM = E27HBR7TL2;
475 | INFOPLIST_FILE = "SwiftFlags-iOS/Info.plist";
476 | IPHONEOS_DEPLOYMENT_TARGET = 13.4;
477 | LD_RUNPATH_SEARCH_PATHS = (
478 | "$(inherited)",
479 | "@executable_path/Frameworks",
480 | );
481 | PRODUCT_BUNDLE_IDENTIFIER = "net.bubidevs.SwiftFlags-iOS";
482 | PRODUCT_NAME = "$(TARGET_NAME)";
483 | SWIFT_VERSION = 5.0;
484 | TARGETED_DEVICE_FAMILY = "1,2";
485 | };
486 | name = Debug;
487 | };
488 | DCC571A724549F0800692503 /* Release */ = {
489 | isa = XCBuildConfiguration;
490 | buildSettings = {
491 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
492 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
493 | CODE_SIGN_STYLE = Automatic;
494 | DEVELOPMENT_TEAM = E27HBR7TL2;
495 | INFOPLIST_FILE = "SwiftFlags-iOS/Info.plist";
496 | IPHONEOS_DEPLOYMENT_TARGET = 13.4;
497 | LD_RUNPATH_SEARCH_PATHS = (
498 | "$(inherited)",
499 | "@executable_path/Frameworks",
500 | );
501 | PRODUCT_BUNDLE_IDENTIFIER = "net.bubidevs.SwiftFlags-iOS";
502 | PRODUCT_NAME = "$(TARGET_NAME)";
503 | SWIFT_VERSION = 5.0;
504 | TARGETED_DEVICE_FAMILY = "1,2";
505 | };
506 | name = Release;
507 | };
508 | DCC571B324549F2B00692503 /* Debug */ = {
509 | isa = XCBuildConfiguration;
510 | buildSettings = {
511 | CLANG_ENABLE_MODULES = YES;
512 | CODE_SIGN_STYLE = Automatic;
513 | CURRENT_PROJECT_VERSION = 1;
514 | DEFINES_MODULE = YES;
515 | DEVELOPMENT_TEAM = E27HBR7TL2;
516 | DYLIB_COMPATIBILITY_VERSION = 1;
517 | DYLIB_CURRENT_VERSION = 1;
518 | DYLIB_INSTALL_NAME_BASE = "@rpath";
519 | INFOPLIST_FILE = SwiftFlags/Info.plist;
520 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
521 | IPHONEOS_DEPLOYMENT_TARGET = 13.4;
522 | LD_RUNPATH_SEARCH_PATHS = (
523 | "$(inherited)",
524 | "@executable_path/Frameworks",
525 | "@loader_path/Frameworks",
526 | );
527 | PRODUCT_BUNDLE_IDENTIFIER = net.bubidevs.SwiftFlags;
528 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
529 | SKIP_INSTALL = YES;
530 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
531 | SWIFT_VERSION = 5.0;
532 | TARGETED_DEVICE_FAMILY = "1,2";
533 | VERSIONING_SYSTEM = "apple-generic";
534 | VERSION_INFO_PREFIX = "";
535 | };
536 | name = Debug;
537 | };
538 | DCC571B424549F2B00692503 /* Release */ = {
539 | isa = XCBuildConfiguration;
540 | buildSettings = {
541 | CLANG_ENABLE_MODULES = YES;
542 | CODE_SIGN_STYLE = Automatic;
543 | CURRENT_PROJECT_VERSION = 1;
544 | DEFINES_MODULE = YES;
545 | DEVELOPMENT_TEAM = E27HBR7TL2;
546 | DYLIB_COMPATIBILITY_VERSION = 1;
547 | DYLIB_CURRENT_VERSION = 1;
548 | DYLIB_INSTALL_NAME_BASE = "@rpath";
549 | INFOPLIST_FILE = SwiftFlags/Info.plist;
550 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
551 | IPHONEOS_DEPLOYMENT_TARGET = 13.4;
552 | LD_RUNPATH_SEARCH_PATHS = (
553 | "$(inherited)",
554 | "@executable_path/Frameworks",
555 | "@loader_path/Frameworks",
556 | );
557 | PRODUCT_BUNDLE_IDENTIFIER = net.bubidevs.SwiftFlags;
558 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
559 | SKIP_INSTALL = YES;
560 | SWIFT_VERSION = 5.0;
561 | TARGETED_DEVICE_FAMILY = "1,2";
562 | VERSIONING_SYSTEM = "apple-generic";
563 | VERSION_INFO_PREFIX = "";
564 | };
565 | name = Release;
566 | };
567 | DCCD778B2454A1B500CCC426 /* Debug */ = {
568 | isa = XCBuildConfiguration;
569 | buildSettings = {
570 | CODE_SIGN_STYLE = Automatic;
571 | DEVELOPMENT_TEAM = E27HBR7TL2;
572 | INFOPLIST_FILE = "SwiftFlags-Tests/Info.plist";
573 | IPHONEOS_DEPLOYMENT_TARGET = 13.4;
574 | LD_RUNPATH_SEARCH_PATHS = (
575 | "$(inherited)",
576 | "@executable_path/Frameworks",
577 | "@loader_path/Frameworks",
578 | );
579 | PRODUCT_BUNDLE_IDENTIFIER = "net.bubidevs.SwiftFlags-Tests";
580 | PRODUCT_NAME = "$(TARGET_NAME)";
581 | SWIFT_VERSION = 5.0;
582 | TARGETED_DEVICE_FAMILY = "1,2";
583 | };
584 | name = Debug;
585 | };
586 | DCCD778C2454A1B500CCC426 /* Release */ = {
587 | isa = XCBuildConfiguration;
588 | buildSettings = {
589 | CODE_SIGN_STYLE = Automatic;
590 | DEVELOPMENT_TEAM = E27HBR7TL2;
591 | INFOPLIST_FILE = "SwiftFlags-Tests/Info.plist";
592 | IPHONEOS_DEPLOYMENT_TARGET = 13.4;
593 | LD_RUNPATH_SEARCH_PATHS = (
594 | "$(inherited)",
595 | "@executable_path/Frameworks",
596 | "@loader_path/Frameworks",
597 | );
598 | PRODUCT_BUNDLE_IDENTIFIER = "net.bubidevs.SwiftFlags-Tests";
599 | PRODUCT_NAME = "$(TARGET_NAME)";
600 | SWIFT_VERSION = 5.0;
601 | TARGETED_DEVICE_FAMILY = "1,2";
602 | };
603 | name = Release;
604 | };
605 | /* End XCBuildConfiguration section */
606 |
607 | /* Begin XCConfigurationList section */
608 | DC6193CF2454717C00845FC7 /* Build configuration list for PBXProject "SwiftFlags" */ = {
609 | isa = XCConfigurationList;
610 | buildConfigurations = (
611 | DC6193E62454718000845FC7 /* Debug */,
612 | DC6193E72454718000845FC7 /* Release */,
613 | );
614 | defaultConfigurationIsVisible = 0;
615 | defaultConfigurationName = Release;
616 | };
617 | DCC571A524549F0800692503 /* Build configuration list for PBXNativeTarget "SwiftFlags-iOS" */ = {
618 | isa = XCConfigurationList;
619 | buildConfigurations = (
620 | DCC571A624549F0800692503 /* Debug */,
621 | DCC571A724549F0800692503 /* Release */,
622 | );
623 | defaultConfigurationIsVisible = 0;
624 | defaultConfigurationName = Release;
625 | };
626 | DCC571B224549F2B00692503 /* Build configuration list for PBXNativeTarget "SwiftFlags" */ = {
627 | isa = XCConfigurationList;
628 | buildConfigurations = (
629 | DCC571B324549F2B00692503 /* Debug */,
630 | DCC571B424549F2B00692503 /* Release */,
631 | );
632 | defaultConfigurationIsVisible = 0;
633 | defaultConfigurationName = Release;
634 | };
635 | DCCD778D2454A1B500CCC426 /* Build configuration list for PBXNativeTarget "SwiftFlags-Tests" */ = {
636 | isa = XCConfigurationList;
637 | buildConfigurations = (
638 | DCCD778B2454A1B500CCC426 /* Debug */,
639 | DCCD778C2454A1B500CCC426 /* Release */,
640 | );
641 | defaultConfigurationIsVisible = 0;
642 | defaultConfigurationName = Release;
643 | };
644 | /* End XCConfigurationList section */
645 | };
646 | rootObject = DC6193CC2454717C00845FC7 /* Project object */;
647 | }
648 |
--------------------------------------------------------------------------------
/SampleApp/SwiftFlags.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/SampleApp/SwiftFlags.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/SampleApp/SwiftFlags/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | $(CURRENT_PROJECT_VERSION)
21 |
22 |
23 |
--------------------------------------------------------------------------------
/SampleApp/SwiftFlags/SwiftFlags.h:
--------------------------------------------------------------------------------
1 | //
2 | // SwiftFlags.h
3 | // SwiftFlags
4 | //
5 | // Created by Busi Andrea on 25/04/2020.
6 | // Copyright © 2020 BubiDevs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | //! Project version number for SwiftFlags.
12 | FOUNDATION_EXPORT double SwiftFlagsVersionNumber;
13 |
14 | //! Project version string for SwiftFlags.
15 | FOUNDATION_EXPORT const unsigned char SwiftFlagsVersionString[];
16 |
17 | // In this header, you should import all the public headers of your framework using statements like #import
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Sources/SwiftFlags/SwiftFlags.swift:
--------------------------------------------------------------------------------
1 | // MIT License
2 | //
3 | // Copyright (c) 2020 Andrea Busi
4 | //
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | import Foundation
24 |
25 | @objc
26 | final public class SwiftFlags: NSObject {
27 |
28 | private static let countries: [String: [String]] = [
29 | "AD": ["Andorra", "Andorran"],
30 | "AE": ["United Arab Emirates", "UAE", "Emirati"],
31 | "AF": ["Afghanistan", "Afghan"],
32 | "AG": ["Antigua and Barbuda", "Antiguan, Barbudan"],
33 | "AI": ["Anguilla", "Anguillian"],
34 | "AL": ["Albania", "Albanian"],
35 | "AM": ["Armenia", "Armenian"],
36 | "AN": ["Netherlands Antilles"],
37 | "AO": ["Angola", "Angolan"],
38 | "AQ": ["Antarctica", "Antarctican"],
39 | "AR": ["Argentina", "Argentine"],
40 | "AS": ["American Samoa", "American Samoan"],
41 | "AT": ["Austria", "Austrian"],
42 | "AU": ["Australia", "Australian"],
43 | "AW": ["Aruba", "Aruban"],
44 | "AX": ["Åland Islands", "Ålandish"],
45 | "AZ": ["Azerbaijan", "Azerbaijani"],
46 | "BA": ["Bosnia and Herzegovina", "Bosnian, Herzegovinian"],
47 | "BB": ["Barbados", "Barbadian"],
48 | "BD": ["Bangladesh", "Bangladeshi"],
49 | "BE": ["Belgium", "Belgian"],
50 | "BF": ["Burkina Faso", "Burkinabe"],
51 | "BG": ["Bulgaria", "Bulgarian"],
52 | "BH": ["Bahrain", "Bahraini"],
53 | "BI": ["Burundi", "Burundian"],
54 | "BJ": ["Benin", "Beninese"],
55 | "BM": ["Bermuda", "Bermudian"],
56 | "BN": ["Brunei Darussalam", "Bruneian"],
57 | "BO": ["Bolivia", "Bolivian"],
58 | "BR": ["Brazil", "Brazilian"],
59 | "BS": ["Bahamas", "Bahamian"],
60 | "BT": ["Bhutan", "Bhutanese"],
61 | "BV": ["Bouvet Island"],
62 | "BW": ["Botswana", "Motswana"],
63 | "BY": ["Belarus", "Belarusian"],
64 | "BZ": ["Belize", "Belizean"],
65 | "CA": ["Canada", "Canadian"],
66 | "CC": ["Cocos (Keeling) Islands", "Cocos Islander"],
67 | "CD": ["Congo, The Democratic Republic of the"],
68 | "CF": ["Central African Republic", "Central African"],
69 | "CG": ["Congo"],
70 | "CH": ["Switzerland", "Swiss"],
71 | "CI": ["Cote D'Ivoire", "Ivorian"],
72 | "CK": ["Cook Islands", "Cook Islander"],
73 | "CL": ["Chile", "Chilean"],
74 | "CM": ["Cameroon", "Cameroonian"],
75 | "CN": ["China", "Chinese"],
76 | "CO": ["Colombia", "Colombian"],
77 | "CR": ["Costa Rica", "Costa Rican"],
78 | "CU": ["Cuba", "Cuban"],
79 | "CV": ["Cape Verde", "Cape Verdian", "Cabo Verde"],
80 | "CX": ["Christmas Island", "Christmas Islander"],
81 | "CY": ["Cyprus", "Cypriot"],
82 | "CZ": ["Czechia", "Czech Republic", "Czech"],
83 | "DE": ["Germany", "German"],
84 | "DJ": ["Djibouti"],
85 | "DK": ["Denmark", "Danish"],
86 | "DM": ["Dominica"],
87 | "DO": ["Dominican Republic"],
88 | "DZ": ["Algeria", "Algerian"],
89 | "EC": ["Ecuador", "Ecuadorean"],
90 | "EE": ["Estonia", "Estonian"],
91 | "EG": ["Egypt", "Egyptian"],
92 | "EH": ["Western Sahara", "Sahrawi"],
93 | "ER": ["Eritrea", "Eritrean"],
94 | "ES": ["Spain", "Spanish"],
95 | "ET": ["Ethiopia", "Ethiopian"],
96 | "EU": ["European Union"],
97 | "FI": ["Finland", "Finnish"],
98 | "FJ": ["Fiji", "Fijian"],
99 | "FK": ["Falkland Islands (Malvinas)", "Falkland Islander"],
100 | "FM": ["Micronesia, Federated States of", "Micronesian"],
101 | "FO": ["Faroe Islands", "Faroese"],
102 | "FR": ["France", "French"],
103 | "GA": ["Gabon", "Gabonese"],
104 | "GB": ["United Kingdom", "UK", "British"],
105 | "GD": ["Grenada", "Grenadian"],
106 | "GE": ["Georgia", "Georgian"],
107 | "GF": ["French Guiana", "Guianan"],
108 | "GG": ["Guernsey"],
109 | "GH": ["Ghana", "Ghanaian"],
110 | "GI": ["Gibraltar"],
111 | "GL": ["Greenland", "Greenlandic"],
112 | "GM": ["Gambia", "Gambian"],
113 | "GN": ["Guinea", "Guinean"],
114 | "GP": ["Guadeloupe", "Guadeloupian"],
115 | "GQ": ["Equatorial Guinea", "Equatorial Guinean"],
116 | "GR": ["Greece", "Greek"],
117 | "GS": ["South Georgia and the South Sandwich Islands", "South Georgian South Sandwich Islander"],
118 | "GT": ["Guatemala", "Guatemalan"],
119 | "GU": ["Guam", "Guamanian"],
120 | "GW": ["Guinea-Bissau", "Guinea-Bissauan"],
121 | "GY": ["Guyana", "Guyanese"],
122 | "HK": ["Hong Kong", "Hong Konger"],
123 | "HM": ["Heard Island and Mcdonald Islands", "Heard and McDonald Islander"],
124 | "HN": ["Honduras", "Honduran"],
125 | "HR": ["Croatia", "Croatian"],
126 | "HT": ["Haiti", "Haitian"],
127 | "HU": ["Hungary", "Hungarian"],
128 | "ID": ["Indonesia", "Indonesian"],
129 | "IE": ["Ireland", "Irish"],
130 | "IL": ["Israel", "Israeli"],
131 | "IM": ["Isle of Man", "Manx"],
132 | "IN": ["India", "Indian"],
133 | "IO": ["British Indian Ocean Territory"],
134 | "IQ": ["Iraq", "Iraqi"],
135 | "IR": ["Iran, Islamic Republic Of", "Iranian"],
136 | "IS": ["Iceland", "Icelander"],
137 | "IT": ["Italy", "Italian"],
138 | "JE": ["Jersey"],
139 | "JM": ["Jamaica", "Jamaican"],
140 | "JO": ["Jordan", "Jordanian"],
141 | "JP": ["Japan", "Japanese"],
142 | "KE": ["Kenya", "Kenyan"],
143 | "KG": ["Kyrgyzstan", "Kirghiz"],
144 | "KH": ["Cambodia", "Cambodian"],
145 | "KI": ["Kiribati", "I-Kiribati"],
146 | "KM": ["Comoros", "Comoran"],
147 | "KN": ["Saint Kitts and Nevis", "Kittitian or Nevisian"],
148 | "KP": ["Korea, Democratic People's Republic of", "North Korea", "North Korean", "DPRK"],
149 | "KR": ["Korea, Republic of", "South Korea", "South Korean"],
150 | "KW": ["Kuwait", "Kuwaiti"],
151 | "KY": ["Cayman Islands", "Caymanian"],
152 | "KZ": ["Kazakhstan", "Kazakhstani"],
153 | "LA": ["Lao People's Democratic Republic", "Laotian", "Laos"],
154 | "LB": ["Lebanon", "Lebanese"],
155 | "LC": ["Saint Lucia", "Saint Lucian"],
156 | "LI": ["Liechtenstein", "Liechtensteiner"],
157 | "LK": ["Sri Lanka", "Sri Lankan"],
158 | "LR": ["Liberia", "Liberian"],
159 | "LS": ["Lesotho", "Mosotho"],
160 | "LT": ["Lithuania", "Lithuanian"],
161 | "LU": ["Luxembourg", "Luxembourger"],
162 | "LV": ["Latvia", "Latvian"],
163 | "LY": ["Libyan Arab Jamahiriya", "Libyan"],
164 | "MA": ["Morocco", "Moroccan"],
165 | "MC": ["Monaco", "Monegasque"],
166 | "MD": ["Moldova, Republic of", "Moldovan"],
167 | "ME": ["Montenegro", "Montenegrin"],
168 | "MG": ["Madagascar", "Malagasy"],
169 | "MH": ["Marshall Islands", "Marshallese"],
170 | "MK": ["Macedonia, The Former Yugoslav Republic of", "Macedonian", "North Macedonia, Republic of"],
171 | "ML": ["Mali", "Malian"],
172 | "MM": ["Myanmar", "Burma", "Burmese"],
173 | "MN": ["Mongolia", "Mongolian"],
174 | "MO": ["Macao", "Macau", "Macanese"],
175 | "MP": ["Northern Mariana Islands"],
176 | "MQ": ["Martinique"],
177 | "MR": ["Mauritania", "Mauritanian"],
178 | "MS": ["Montserrat", "Montserratian"],
179 | "MT": ["Malta", "Maltese"],
180 | "MU": ["Mauritius", "Mauritian"],
181 | "MV": ["Maldives", "Maldivan"],
182 | "MW": ["Malawi", "Malawian"],"MX": ["Mexico", "Mexican"],
183 | "MY": ["Malaysia", "Malaysian"],
184 | "MZ": ["Mozambique", "Mozambican"],
185 | "NA": ["Namibia", "Namibian"],
186 | "NC": ["New Caledonia", "New Caledonian"],
187 | "NE": ["Niger", "Nigerien"],
188 | "NF": ["Norfolk Island", "Norfolk Islander"],
189 | "NG": ["Nigeria", "Nigerian"],
190 | "NI": ["Nicaragua", "Nicaraguan"],
191 | "NL": ["Netherlands", "Dutch"],
192 | "NO": ["Norway", "Norwegian"],
193 | "NP": ["Nepal", "Nepalese"],
194 | "NR": ["Nauru", "Nauruan"],
195 | "NU": ["Niue", "Niuean"],
196 | "NZ": ["New Zealand", "New Zealander"],
197 | "OM": ["Oman", "Omani"],
198 | "PA": ["Panama", "Panamanian"],
199 | "PE": ["Peru", "Peruvian"],
200 | "PF": ["French Polynesia", "French Polynesian"],
201 | "PG": ["Papua New Guinea", "Papua New Guinean"],
202 | "PH": ["Philippines", "Filipino"],
203 | "PK": ["Pakistan", "Pakistani"],
204 | "PL": ["Poland", "Polish"],
205 | "PM": ["Saint Pierre and Miquelon"],
206 | "PN": ["Pitcairn", "Pitcairn Islander"],
207 | "PR": ["Puerto Rico", "Puerto Rican"],
208 | "PS": ["Palestinian Territory, Occupied", "Palestine", "Palestinian"],
209 | "PT": ["Portugal", "Portuguese"],
210 | "PW": ["Palau", "Palauan"],
211 | "PY": ["Paraguay", "Paraguayan"],
212 | "QA": ["Qatar", "Qatari"],
213 | "RE": ["Reunion"],
214 | "RO": ["Romania", "Romanian"],
215 | "RS": ["Serbia", "Serbian"],
216 | "RU": ["Russian Federation", "Russian"],
217 | "RW": ["Rwanda", "Rwandan"],
218 | "SA": ["Saudi Arabia", "Saudi Arabian"],
219 | "SB": ["Solomon Islands", "Solomon Islander"],
220 | "SC": ["Seychelles", "Seychellois"],
221 | "SD": ["Sudan", "Sudanese"],
222 | "SE": ["Sweden", "Swedish"],
223 | "SG": ["Singapore", "Singaporean"],
224 | "SH": ["Saint Helena", "Saint Helenian"],
225 | "SI": ["Slovenia", "Slovene"],
226 | "SJ": ["Svalbard and Jan Mayen"],
227 | "SK": ["Slovakia", "Slovak"],
228 | "SL": ["Sierra Leone", "Sierra Leonean"],
229 | "SM": ["San Marino", "Sammarinese"],
230 | "SN": ["Senegal", "Senegalese"],
231 | "SO": ["Somalia", "Somali"],
232 | "SR": ["Suriname", "Surinamer"],
233 | "ST": ["Sao Tome and Principe", "Sao Tomean"],
234 | "SV": ["El Salvador", "Salvadoran"],
235 | "SY": ["Syrian Arab Republic", "Syrian"],
236 | "SZ": ["Swaziland", "Swazi"],
237 | "TC": ["Turks and Caicos Islands", "Turks and Caicos Islander"],
238 | "TD": ["Chad", "Chadian"],
239 | "TF": ["French Southern Territories"],
240 | "TG": ["Togo", "Togolese"],
241 | "TH": ["Thailand", "Thai"],
242 | "TJ": ["Tajikistan", "Tadzhik"],
243 | "TK": ["Tokelau", "Tokelauan"],
244 | "TL": ["Timor-Leste", "East Timorese"],
245 | "TM": ["Turkmenistan", "Turkmen"],
246 | "TN": ["Tunisia", "Tunisian"],
247 | "TO": ["Tonga", "Tongan"],
248 | "TR": ["Turkey", "Turkish"],
249 | "TT": ["Trinidad and Tobago", "Trinidadian"],
250 | "TV": ["Tuvalu", "Tuvaluan"],
251 | "TW": ["Taiwan", "Taiwanese"],
252 | "TZ": ["Tanzania, United Republic of", "Tanzanian"],
253 | "UA": ["Ukraine", "Ukrainian"],
254 | "UG": ["Uganda", "Ugandan"],
255 | "UM": ["United States Minor Outlying Islands"],
256 | "US": ["United States", "USA", "American"],
257 | "UY": ["Uruguay", "Uruguayan"],
258 | "UZ": ["Uzbekistan", "Uzbekistani"],
259 | "VA": ["Holy See (Vatican City State)", "Vatican"],
260 | "VC": ["Saint Vincent and the Grenadines", "Saint Vincentian"],
261 | "VE": ["Venezuela", "Venezuelan"],
262 | "VG": ["Virgin Islands, British"],
263 | "VI": ["Virgin Islands, U.S."],
264 | "VN": ["Vietnam", "Viet Nam", "Vietnamese"],
265 | "VU": ["Vanuatu", "Ni-Vanuatu"],
266 | "WF": ["Wallis and Futuna", "Wallis and Futuna Islander"],
267 | "WS": ["Samoa", "Samoan"],
268 | "XK": ["Kosovo", "Kosovar"],
269 | "YE": ["Yemen", "Yemeni"],
270 | "YT": ["Mayotte", "Mahoran"],
271 | "ZA": ["South Africa", "South African"],
272 | "ZM": ["Zambia", "Zambian"],
273 | "ZW": ["Zimbabwe", "Zimbabwean"]
274 | ]
275 |
276 | // MARK: - Public
277 |
278 | /// Returns the emoji flag for the given country.
279 | ///
280 | /// Examples:
281 | /// - flag(for: "it") -> 🇮🇹
282 | /// - flag(for: "united states") -> 🇺🇸
283 | /// - flag(for: "england") -> nil
284 | ///
285 | /// - Parameter country: Name or ISO 3166-1 code of the country
286 | /// - Returns: Emoji flag if available, nil otherwise
287 | @objc public class func flag(for country: String) -> String? {
288 | if let code = countryCode(for: country) {
289 | return emojiFlag(for: code)
290 | }
291 |
292 | return nil
293 | }
294 |
295 | /// Returns only the country code for the given country.
296 | /// - Parameter country: Name of the country
297 | /// - Returns: ISO 3166-1 code for the given country, nil if no math found
298 | @objc public class func countryCode(for country: String) -> String? {
299 | let input = trimmed(string: country).lowercased()
300 | if input.isEmpty {
301 | return nil
302 | }
303 |
304 | // check if provided input is already a country code
305 | if isCode(input) {
306 | return country
307 | }
308 |
309 | // search for an exact match
310 | for (countryCode, countryNames) in countries {
311 | for countryName in countryNames {
312 | if countryName.lowercased() == input {
313 | return countryCode
314 | }
315 | }
316 | }
317 |
318 | // search for an inexact match
319 | // using a set, we are going to keep only one entry for each country code found
320 | var results = Set()
321 | for (countryCode, countryNames) in countries {
322 | for countryName in countryNames {
323 | if compare(input: input, countryName: countryName) {
324 | results.insert(countryCode)
325 | }
326 | }
327 | }
328 |
329 | // seturns only when exactly one match was found
330 | // it prevents cases like "United" to produce a result
331 | if results.count == 1, let code = results.first {
332 | return code
333 | }
334 |
335 | return nil
336 | }
337 |
338 | // MARK: - Private
339 |
340 | private class func isCode(_ code: String) -> Bool {
341 | countries[code.uppercased()] != nil
342 | }
343 |
344 | private class func compare(input anInput: String, countryName aCountryName: String) -> Bool {
345 | let input = anInput.lowercased()
346 | let countryName = aCountryName.lowercased()
347 |
348 | // cases like:
349 | // "Vatican" <-> "Holy See (Vatican City State)"
350 | // "Russia" <-> "Russian Federation"
351 | if (countryName.contains(input) || input.contains(countryName)) {
352 | return true
353 | }
354 |
355 | // cases like:
356 | // "British Virgin Islands" <-> "Virgin Islands, British"
357 | // "Republic of Moldova" <-> "Moldova, Republic of"
358 | if (input.contains(",")) {
359 | let reversed = input.split(separator: ",").reversed().joined(separator: " ")
360 | if (reversed.contains(countryName) || countryName.contains(reversed)) {
361 | return true
362 | }
363 | }
364 |
365 | return false
366 | }
367 |
368 | // MARK: - Helpers
369 |
370 | private class func trimmed(string: String) -> String {
371 | string.trimmingCharacters(in: .whitespacesAndNewlines)
372 | }
373 |
374 | /// Converts an ISO country code into the emoji flag (unicode)
375 | /// Note: no check performed on the validity of the countryCode passed as input
376 | /// - Parameter countryCode: Country code to convert
377 | /// - Returns: Emoji flag
378 | private class func emojiFlag(for countryCode: String) -> String {
379 | let baseFlagScalar: UInt32 = 127397
380 | var flagString = ""
381 | for scalarValue in countryCode.uppercased().unicodeScalars {
382 | guard let scalar = UnicodeScalar(baseFlagScalar + scalarValue.value) else {
383 | continue
384 | }
385 | flagString.unicodeScalars.append(scalar)
386 | }
387 | return flagString
388 | }
389 | }
390 |
--------------------------------------------------------------------------------
/SwiftFlags.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = "SwiftFlags"
3 | s.version = "1.2.0"
4 | s.summary = "Simple Swift library to get emoji flag from a country name or country code (ISO 3166-1)."
5 | s.homepage = "https://github.com/BubiDevs/SwiftFlags.git"
6 | s.license = { :type => "MIT", :file => "LICENSE" }
7 | s.author = { "Andrea Busi" => "busi.andrea@gmail.com" }
8 | s.social_media_url = "https://twitter.com/bubidevs"
9 | s.ios.deployment_target = "10.0"
10 | s.source = { :git => "https://github.com/BubiDevs/SwiftFlags.git", :tag => s.version.to_s }
11 | s.source_files = 'Sources/**/*.{swift,h,m}'
12 | s.frameworks = "Foundation"
13 | s.swift_versions = ['5.0', '5.1']
14 | end
15 |
--------------------------------------------------------------------------------
/Tests/LinuxMain.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 |
3 | import SwiftFlagsTests
4 |
5 | var tests = [XCTestCaseEntry]()
6 | tests += SwiftFlagsTests.allTests()
7 | XCTMain(tests)
8 |
--------------------------------------------------------------------------------
/Tests/SwiftFlagsTests/SwiftFlagsTests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import SwiftFlags
3 |
4 | final class SwiftFlagsTests: XCTestCase {
5 |
6 | func testFlags() {
7 | // test some random flags
8 | XCTAssertNil(SwiftFlags.flag(for: "italaaa"))
9 | XCTAssertEqual(SwiftFlags.flag(for: "it"), "🇮🇹")
10 | XCTAssertEqual(SwiftFlags.flag(for: "united states"), "🇺🇸")
11 | XCTAssertEqual(SwiftFlags.flag(for: "FrAnCe"), "🇫🇷")
12 | XCTAssertNotEqual(SwiftFlags.flag(for: "japan"), "🇨🇳")
13 | }
14 |
15 | func testCountryCodes() {
16 | // test some country codes
17 | XCTAssertEqual(SwiftFlags.countryCode(for: "italy"), "IT")
18 | XCTAssertEqual(SwiftFlags.countryCode(for: "united kingdom"), "GB")
19 | XCTAssertNotEqual(SwiftFlags.countryCode(for: "united kingdom"), "UK")
20 | XCTAssertEqual(SwiftFlags.countryCode(for: "japan"), "JP")
21 | }
22 |
23 | static var allTests = [
24 | ("testFlags", testFlags),
25 | ("testCountryCodes", testCountryCodes)
26 | ]
27 | }
28 |
--------------------------------------------------------------------------------
/Tests/SwiftFlagsTests/XCTestManifests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 |
3 | #if !canImport(ObjectiveC)
4 | public func allTests() -> [XCTestCaseEntry] {
5 | return [
6 | testCase(SwiftFlagsTests.allTests),
7 | ]
8 | }
9 | #endif
10 |
--------------------------------------------------------------------------------