FlagAndCountryCode 1.1.2

FlagAndCountryCode 1.1.2

Exyte 维护。



     

Flag And Country Code

FlagAndCountryCode 为每个国家提供电话代码和旗帜。适用于 UIKit 和 SwiftUI

SPM Compatible Cocoapods Compatible Carthage Compatible License: MIT

使用

使用静态变量 all 来获取 CountryFlagInfo 对象的列表

import FlagAndCountryCode

let countries = CountryFlagInfo.all

每个 CountryFlagInfo 包含以下内容:name - 例如 "美国"
code - 两位代码(“US”)
dialCode - 区号(“+1”)

在任何选择的 CountryFlagInfo 上使用 getCountryImage。它同时提供 UIKit 和 SwiftUI 实现,分别返回 UIImageView。以参数形式传入您想要的国旗样式。

country.getCountryImage(with: .roundedRect)

可用的国旗类型

roundedRect - 21 x 15 带圆角
square - 15 x 15 带圆角
circle - 15 x 15

示例

尝试 FlagAndCountryCode 示例

  • 克隆存储库 https://github.com/exyte/FlagAndCountryCode.git
  • 打开 Example/Example.xcodeproj
  • 尝试它!

安装

Swift 包管理者

dependencies: [
    .package(url: "https://github.com/exyte/FlagAndCountryCode.git")
]

CocoaPods

安装FlagAndCountryCode,只需将以下行添加到您的Podfile中

pod 'FlagAndCountryCode'

Carthage

要使用Carthage将FlagAndCountryCode集成到您的Xcode项目中,请在您的Cartfile中指定它

github "Exyte/FlagAndCountryCode"

要求

  • iOS 15+
  • Xcode 15+

我们的其他开源SwiftUI库

PopupView - 消息和弹出窗口库
Grid - 最强大的网格容器
ScalingHeaderScrollView - 带粘性头部的滚动视图,在滚动时头部会收缩。
AnimatedTabBar - 带内置动画预设置的标签栏
MediaPicker - 可定制的媒体选择器
Chat - 带完整自定义消息单元、输入视图和内置媒体选择器的聊天UI框架
ConcentricOnboarding - 动画引导流程
FloatingButton - 浮动按钮菜单
ActivityIndicatorView - 带多种动画加载指示器的例子
ProgressIndicatorView - 动画进度指示器组件
SVGView - SVG 解析器
LiquidSwipe - 流体导航动画