CountriesViewController 0.1.2

CountriesViewController 0.1.2

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布上次发布2017年10月
SwiftSwift 版本3.0
SPM支持 SPM

LucaBecchetti 维护。



  • 作者
  • Becchetti Luca

CountriesViewController - 允许用户选择国家的视图控制器。它支持单选或复选

CountriesViewController

通常在开发过程中,我需要从列表中选择一个国家,这个简单的控制器可以让你显示国家列表,并使用当前区域语言选择它们。为你的下一个项目选择 CountriesViewController,我很乐意给你一点帮助!

★★ 在我们的 Github 仓库上打星以帮助我们!,或者 ☕ 支付一杯咖啡 ★★

Luca Becchetti 创建

屏幕截图

要求

  • iOS 9+
  • swift 3.0

主要功能

以下是 CountriesViewController 提供的主要功能:

  • 当前区域翻译 国家名称使用当前区域翻译显示
  • 单选或复选。您可以将选项用作单选或复选

你可能也会喜欢

你喜欢 CountriesViewController 吗?我还致力于几个其他开源库。

请查看这里

Podfile

要将 CountriesViewController 集成到你的 Xcode 项目中,使用 CocoaPods,请将其指定在你的 Podfile

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'

target 'TargetName' do
  use_frameworks!
  pod 'CountriesViewController'
end

然后,运行以下命令

$ pod install

如何使用

首先,在项目中导入库

import CountriesViewController

显示简单通知的基本代码如下

//If you are in a UIViewController

let countriesViewController = CountriesViewController()
countriesViewController.delegate = self
CountriesViewController.Show(countriesViewController: countriesViewController, to: self)

还需要实现CountriesViewControllerDelegate

extension YourViewController : CountriesViewControllerDelegate{
  /// MARK: CountriesViewControllerDelegate
    
    func countriesViewController(_ countriesViewController: CountriesViewController, didSelectCountries countries: [Country]){
        
        countries.forEach { (co) in
            print(co.name);
        }
    }

    func countriesViewControllerDidCancel(_ countriesViewController: CountriesViewController) {
        
        print("user hass been tap cancel")
        
    }
    
    func countriesViewController(_ countriesViewController: CountriesViewController, didSelectCountry country: Country) {
        
        print(country.name+" selected")
        
    }
    
    func countriesViewController(_ countriesViewController: CountriesViewController, didUnselectCountry country: Country) {
        
        print(country.name+" unselected")
        
    }
}

定制

您可以在初始化过程中自定义这些参数

/// Create a controller
let countriesViewController = CountriesViewController()
        
/// Show major country (this countries are displayed in top of tableview, before each others)
countriesViewController.majorCountryLocaleIdentifiers = ["GB", "US", "IT", "DE", "RU", "BR", "IN"]
        
/// Set initial selected countries
countriesViewController.selectedCountries = Countries.countriesFromCountryCodes(["AL"])
        
/// Allow or disallow multiple selection
countriesViewController.allowMultipleSelection = true
        
/// Set delegate
countriesViewController.delegate = self
        
/// Show
CountriesViewController.Show(countriesViewController: countriesViewController, to: self)

使用CountriesViewController的项目

您的应用程序和InAppNotify

我感兴趣的是制作所有使用此库的项目列表。请在GitHub上提交带有项目名称和链接的Issue,我们将将其添加到本网站上。

致谢 & 许可证

CountriesViewController由Luca Becchetti拥有并维护

作为开源创作,任何帮助都受欢迎!

此库的代码根据MIT许可证授权;您可以在任何商业产品中使用它,没有任何限制。

唯一的要求是在您的致谢/关于部分添加以下文本的一行

Countries selection by CountriesViewController - http://www.lucabecchetti.com
Created by Becchetti Luca and licensed under MIT License.

关于我

我是一名专业程序员,拥有软件设计和发展背景,目前在一家名为“Frind”的创业公司担任项目经理和ios高级软件工程师,提高我的专业技能。

我在软件开发(10+年经验)方面技能高超,从小就是网站管理员,并是一名资深Php开发者。在过去的几年里,我致力于移动应用程序开发,为iOS世界编写Swift代码,为Android世界编写Java代码。

我是一位经验丰富的移动应用程序开发者和架构师,具有团队管理、设计和开发所有主要移动平台(iOS、Android,3+年经验)的经验。

我还在客户端和服务器端Web设计和开发以及API/网络设计方面拥有广泛的经验。

我的所有最新工作都在AWS Amazon云上托管,我能够配置网络,使用Unix服务器。对于我的最新工作,我配置了apache2、ssl、ejabberd集群模式、带负载均衡器的API服务器等。

我住在意大利阿西西(佩鲁贾)的一个小镇上,如有任何问题,请联系我