MLQuestionCheck

 

Platforms License

Swift Package Manager Carthage compatible CocoaPods compatible

Travis

Swift 项目的检查组件

要求

安装

依赖管理器

CocoaPods

CocoaPods 是 Cocoa 项目的依赖管理器。您可以使用以下命令安装它

$ gem install cocoapods

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

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

pod 'MLQuestionCheck', '~> 1.1.3'

然后,运行以下命令

$ pod install
Carthage

Carthage 是一个去中心化的依赖管理器,它可以自动执行将框架添加到您的 Cocoa 应用程序的过程。

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

$ brew update
$ brew install carthage

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

github "micheltlutz/MLQuestionCheck" ~> 1.1.3
Swift Package Manager

要将 MLQuestionCheck 用作 Swift Package Manager 包,只需在您的 Package.swift 文件中添加以下内容。

// swift-tools-version:4.1

import PackageDescription

let package = Package(
    name: "HelloMLQuestionCheck",
    dependencies: [
        .package(url: "https://github.com/micheltlutz/MLQuestionCheck.git", .upToNextMajor(from: "1.1.3"))
    ],
    targets: [
        .target(name: "HelloMLQuestionCheck", dependencies: ["MLQuestionCheck"])
    ]
)

手动

如果您不想使用上述任何依赖管理器,您可以手动将 MLQuestionCheck 集成到您的项目中。

Git 子模块

$ git init
$ git submodule add https://github.com/micheltlutz/MLQuestionCheck.git
$ git submodule update --init --recursive

MLQuestionCheck.framework 会自动添加为目标依赖项、链接框架和嵌入式框架,在复制文件构建阶段中,这是在模拟器和设备上构建所需的一切。

嵌入式二进制文件

使用方法

您需要在 Assets 中添加两个带有名称的图像文件

import MLQuestionCheck

let question1 = MLQuestionCheck(question: "You are ok?")
question1.didChangeState = { checked in
    print("question1 checked? \(checked)")
}

您可以更改图像名称

question1.uncheckedImageName = "new image name"
question1.checkedImageName = "new image name"
question1.setupCheck() // to change configuration buttons

或自定义字体宽度和运行时更改文本

let questionCheckCustom = MLQuestionCheck(question: "I'm iOS Developer?")
questionCheckCustom.widthQuestion = UIScreen.main.bounds.width
questionCheckCustom.font = UIFont.boldSystemFont(ofSize: 17)
questionCheckCustom.fontChecked = UIFont.boldSystemFont(ofSize: 20)
questionCheckCustom.didChangeState = { isChecked in
	print("questionCheck.isChecked: \(isChecked)")
}

Timer.scheduledTimer(withTimeInterval: 1.0, repeats: false) { (_) in
	self.questionCheckCustom.question = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam."
}

文档

请参阅 文档

MLQuestionCheck 文档(文档完成度 76%)

 

贡献

欢迎提交 Issues 和 Pull Requests!

待办事项

作者

Michel Anderson Lutz Teixeira @michel_lutz

贡献

许可证

MLQuestionCheck 在 MIT 许可证下发布。有关详细信息,请参阅 LICENSE