Swiftpack.co - 0xfeedface1993/JohnCore as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by 0xfeedface1993.
0xfeedface1993/JohnCore v1.0.20
Convenice extension for Swift project.
⭐️ 1
🕓 3 years ago
iOS
.package(url: "https://github.com/0xfeedface1993/JohnCore.git", from: "v1.0.20")

JohnCore

这是我常用的Swift扩展库,使用Swift 5.1编写,很多方法和业务逻辑是无较大关联的,比如判断字符串是不是有效手机号这种功能。

希望你喜欢这个扩展库,祝你好运!

Navigate

UIColor

颜色相关扩展,目前只有16进制颜色转换这一个功能,在UIColor+Hex.swift里面。

public static func hexColor(_ hex: UInt32, alpha: CGFloat = 1.0) -> UIColor

Number

FloatDouble数据转化成优雅的文本,比如数值0.12000转化为字符串0.12.

// fractionDigits暂时没有任何作用
public func niceNumber(withFractionDigits fractionDigits: UInt) -> String

String Validation

手机号、邮箱验证

/// 检测字符串是否是手机号
public func isValidPhone() -> Bool
/// 检测字符串是否是邮箱
/// - Returns: true为是邮箱
public func isEmailAddress() -> Bool 

UIButton

UIButton一般没有什么复杂的封装,为了提升SwiftUI语感和提升代码提示速度,因此此框架添加了链式语法的封装。

actionButton
    .title("确定")
    .forgroundColor(.white)
    .makeBackgroundColorImage(.hexColor(0x259AFA))
    .font(.systemFont(ofSize: 15, weight: .medium))
    .contentInsets(UIEdgeInsets(top: 16, left: 0, bottom: 16, right: 0))
    .cornerRadius(8)

GitHub

link
Stars: 1
Last commit: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics