|
|
|
使用静态变量 all
获取 CountryFlagInfo
对象列表
import FlagAndCountryCode
let countries = CountryFlagInfo.all
每个 CountryFlagInfo
包含: name
- 国家/地区的名称(“美国”)
code
- 两位字母国家/地区代码(“US”)
dialCode
- 电话区号(“+1”)
languageNative
- 语言的原始名称(“Español”)
languageEnglish
- 语言的英文名称(“Spanish”)
在选择的 CountryFlagInfo
上使用 getCountryImage
。它具有 UIKit 和 SwiftUI 实现,分别返回 UIImage
和 View
。传递您想要的国旗样式作为参数。
country.getCountryImage(with: .roundedRect)
roundedRect
- 21 x 15,带有圆角
square
- 15 x 15,带有圆角
circle
- 15 x 15
要尝试 FlagAndCountryCode 示例
https://github.com/exyte/FlagAndCountryCode.git
dependencies: [
.package(url: "https://github.com/exyte/FlagAndCountryCode.git")
]
要安装 FlagAndCountryCode
,只需将以下行添加到您的 Podfile 中
pod 'FlagAndCountryCode'
要使用 Carthage 将 FlagAndCountryCode
集成到您的 Xcode 项目中,请在您的 Cartfile
中指定它
github "Exyte/FlagAndCountryCode"
PopupView - Toasts 和 popups 库
Grid - 最强大的 Grid 容器
ScalingHeaderScrollView - 带有粘性标题的滚动视图,滚动时标题会缩小
AnimatedTabBar - 带有多种预设动画的选项卡栏
MediaPicker - 可定制的媒体选择器
Chat - 聊天 UI 框架,具有完全可定制的消息单元格、输入视图和内置的媒体选择器
OpenAI OpenAI REST API 的 Wrapper 库
AnimatedGradient - 动画线性渐变
ConcentricOnboarding - 动画引导流程
FloatingButton - 浮动按钮菜单
ActivityIndicatorView - 一系列动画加载指示器
ProgressIndicatorView - 一系列动画进度指示器
SVGView - SVG 解析器
LiquidSwipe - 流动导航动画