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 Package Manager
添加依赖的地址和版本
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
String
"test".je.trim()
"test".je.utf8String()
"test".je.length
FileManager
FileManager.default.je.documentPath
FileManager.default.je.libraryPath
FileManager.default.je.cachePath
UIKit
UIApplication
UIApplication.shared.je.appVersion
UIApplication.shared.je.buildVersion
UIApplication.shared.je.appDisplayName
UIApplication.shared.je.currentViewController
UIColor
UIColor.je.random
UIColor.je.hexIntColor(0x121212)
UIColor.je.hexStringColor("0x757575")
UIScreen
UIScreen.je.screenWidth
UIScreen.je.screenHeight
UIScreen.je.screenSize
UIView
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
- 标准库的需要加强
- 搜集更多扩展
License
JJSwiftExtension is released under the MIT license. See LICENSE for details.