BtownToolkit 1.0.3

BtownToolkit 1.0.3

测试已测试
Lang语言 SwiftSwift
许可证 MIT
发布上次发布2018年11月
SPM支持 SPM

Robert Magnusson 维护。



 
依赖项
PureLayout~> 3.1
AngleGradientLayer~> 1.2
 

  • Robert Magnusson

BtownToolkit

platforms

关于 BtownToolkit

此工具包旨在通过提供易于使用且功能丰富的组件和工具来简化应用程序开发者的生活,这些组件和工具我们都在日常代码创建中需要。目标是,一旦发现对新的组件或功能的需求,就立即将它们添加到工具包中。

需求

版本 1.0.0 及以上

  • Xcode 10.0
  • Swift 4.2
  • iOS 11.0+

版本 0.2.0

  • Xcode 9.0
  • Swift 4.0
  • iOS 9.0+

旧版本

  • Xcode 8.0
  • Swift 3.0
  • iOS 9.0+

示例

一些代码示例可以在本项目附带的项目中找到。以下是可用的一些工具的简要概述。

AlertView

AlertView 使用了 UIAlertController 内置的逻辑,但无需从另一个 UIViewController 中展示。只需在 AlertView 上调用 '.show()',它就会在一个单独的 UIWindow 中显示在其他内容之上。

let alertView = AlertView(title: "title", message: "message")
alertView.addTextField(identifier: "TextTield1") { (textField) in
    textField.font = UIFont.boldSystemFont(ofSize: 16)
    textField.textColor = UIColor.red
}
alertView.addAction(title: "Delete", actionType: .destructive, actionCallback: nil) {
    print("Destructive Action")
}
alertView.addAction(title: "Normal", actionType: .normal) {
    print("Normal Action")
}
alertView.addAction(title: "Cancel", actionType: .cancel) {
    print("Cancel Action")
}
alertView.wasDismissedClosure = {
    print("AlertView did disappear")
}
alertView.show()

ImageView-Helpers

ScrollableImageView 是一个可以设置图像并 pinch-to-zoom 进行缩放和滚动查看的视图。ImageCropSelectionView 是一个带有圆形选择区域的 ScrollableImageView,可以从其中提取包含的图像。可用于选择用户头像等。

let scrollableImageView = ScrollableImageView()
scrollableImageView.image = UIImage(named: "ImageExample")
scrollableImageView.setImageZoomScaleToAspectFitViewSize()
scrollableImageView.centerImageInView()

let imageCropSelectionView = ImageCropSelectionView()
imageCropSelectionView.image = UIImage(named: "ImageExample")
...
let userImage = imageCropSelectionView.croppedSelectionImage()

安装

BtownToolkit 通过 CocoaPods 提供

# Podfile
use_frameworks!

target 'YOUR_TARGET_NAME' do
    pod 'BtownToolkit'
end

替换 YOUR_TARGET_NAME,然后在 Podfile 目录中输入

$ pod install

作者

Robert Magnusson,[email protected]

许可

BtownToolkit 基于 MIT 许可证。有关更多信息,请参阅 LICENSE 文件。