WeekdayPicker 0.1.0

WeekdayPicker 0.1.0

Maxime LE COAT 维护。




WeekdayPicker

CocoaPods Compatible Carthage Compatible Platform

WeekdayPicker 是一个带有工作日的自定义 UIDatePicker。

Demo example

要求

  • iOS 9.0+
  • Xcode 9+
  • Swift 4.0+

沟通

  • 如果您想 提出一个一般性问题,请使用 Stack Overflow
  • 如果您 发现了一个错误,请打开一个问题。
  • 如果您 有一个功能请求,请打开一个问题。
  • 如果您 想做出贡献,提交一个拉取请求。

安装

您可以选择以下选项之一来安装 WeekdayPicker。

📦CocoaPods — CocoaPods 是 Xcode 项目的库依赖。[CocoaPods 安装](https://guides.cocoapods.org.cn/using/getting-started.html#getting-started)

使用 CocoaPods 将 WeekdayPicker 集成到您的 Xcode 项目中,请在您的 Podfile 中指定它

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

target '<Your Target Name>' do
    pod 'WeekdayPicker', '~> 1.0'
end

然后,运行以下命令

$ pod install
💉Carthage — Carthage 是一个用于 Cocoa 的去中心化依赖管理器。Carthage (https://github.com/Carthage/Carthage) 是一个去中心化依赖管理器,它构建您的依赖并提供二进制框架。

您可以使用以下命令通过 Homebrew 安装 Carthage

$ brew update
$ brew install carthage

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

github "WeekdayPicker/WeekdayPicker" ~> 4.7

运行 carthage update 来构建框架,然后将构建的 WeekdayPicker.framework 拖入您的 Xcode 项目。

📚Swift Package Manager — Swift 的包管理器。

Swift Package Manager 是用于自动化 Swift 代码分配的工具,集成到 swift 编译器中。它目前处于早期开发阶段,但 WeekdayPicker 支持在支持的平台上使用。

一旦您设置了您的 Swift 包,将 WeekdayPicker 添加为依赖就与将其添加到 Package.swift 中的 dependencies 值一样简单。

dependencies: [
    .package(url: "https://github.com/Maximelc/WeekdayPicker.git", from: "1.0.0")
]

手动

如果您更愿意不使用任何依赖管理器,您可以手动将 WeekdayPicker 集成到项目中。

使用方法

将框架添加到您的项目后,导入模块。

import WeekdayPicker

程序化添加 WeekdayPicker🤓

// Initialization
let myPicker: WeekdayPicker = WeekdayPicker()

// Add delegation conformance
myPicker.delegated = self

// Apply frame
myPicker.frame = CGRect(origin: CGPoint(x: 0, y: 150),
                        size: CGSize(width: self.view.frame.size.width,
                                     height: 150))        

// The first date to show will be the current date
myPicker.setToDate(Date())

// Add picker to current view
self.view.addSubview(myPicker)

实现 WeekdayPickerDelegate🤝

// MARK: - WeekdayPickerDelegate
extension <#MyViewController#>: WeekdayPickerDelegate {

    func weekdayPickerDateChanged(_ date: Date?) {
        if let changedDate = date {
            print("\(changedDate)")
        }
    }
}

文档

完整的文档可以在 这里 找到。

许可证

WeekdayPicker 使用 MIT 许可证发布。有关详细信息,请参阅 LICENSE