JJSwiftExtension 0.0.2

JJSwiftExtension 0.0.2

jezz 维护。



  • 李杰

CocoaPods Compatible Carthage Compatible Platform License MIT

JJSwiftExtension

收集一些常用的扩展,方便开发,提高开发效率,大部分扩展都是基于je命名空间,简化常用操作

安装要求

  • Swift4+
  • iOS9
  • Xcode 8.0+

如何安装

Cocoapod

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

target '<Your Target Name>' do
    pod 'JJSwiftExtension'
end

Cartfile

github "jezzmemo/JJSwiftExtension"

Swift 包管理器

添加依赖的地址和版本

import PackageDescription

let package = Package(
    name: "YOUR_PROJECT_NAME",
    targets: [],
    dependencies: [
        .package(url: "https://github.com/jezzmemo/JJSwiftExtension.git", from: "0.0.2")
    ]
)

Target 添加依赖的名称

.target(
    name: "YOUR_TARGET_NAME",
    dependencies: [
        "JJSwiftExtension",
    ]
),
swift package update

手动

将工程里的 Source 文件复制到自己的工程里即可

如何使用

Foundation

字符串

"test".je.trim()
"test".je.utf8String()
"test".je.length

文件管理器

FileManager.default.je.documentPath
FileManager.default.je.libraryPath
FileManager.default.je.cachePath

UI框架

UI应用程序

UIApplication.shared.je.appVersion
UIApplication.shared.je.buildVersion
UIApplication.shared.je.appDisplayName
UIApplication.shared.je.currentViewController

UI颜色

UIColor.je.random
UIColor.je.hexIntColor(0x121212)
UIColor.je.hexStringColor("0x757575")

UI屏幕

UIScreen.je.screenWidth
UIScreen.je.screenHeight
UIScreen.je.screenSize

UI视图

view.je.left
view.je.right
view.je.top
view.je.bottom
view.je.width
view.je.height
view.je.size

DispatchQueue

asyncMain(block)
delayAyncMain(time,block)

UIDevice

UIDevice.je.isPhone
UIDevice.je.isPad
UIDevice.je.isRetina
UIDevice.je.deviceVersion()

TODO

  • 标准库需要加强
  • 收集更多扩展

许可

JJSwiftExtension 在 MIT 许可下发布。详情见 LICENSE。