🐻 个人开发app利器

SpeedySwift

这是一个app开发的加速库,个人几款app都是基于这个加速库完成的git

尽可能保持开发的原汁原味,欢迎使用,喜欢star✨缓存

我想目前Swift中没有比这个更合适的加速开发app的框架了,若是有请告诉我。 地址:https://github.com/Tliens/SpeedySwift安全

2021-01-08 更新

  • 新增本地通知库 (方便本地通知,定时通知,取消通知,DLLocalNotification取消时会崩溃,已修复放在O5_Vendor中)
  • 扩展添加show alert的快捷方法
  • 增长经过cell上的控件获取cell、index(十分有用)
  • 增长random(让swift中的random变得更加好用)
  • 暗黑模式主题适配 color(day:UIColor,night:UIColor)->UIColor
  • 增长textiew+placeholder
  • AppViewController内增长避免scrollview可能出现的offset问题

特点:

如何使用

下载最新代码后,将AppSpeedy拖入到工程中,暂不支持podmarkdown

要求:Swift5.0及以上网络

代码演示

  • 颜色
UIColor.hex("#22023b")
复制代码
  • 底部安全区高度
let height = App.safeBottomHeight
复制代码
  • 字符串提取
"Hello World!"[safe: 3] -> "l"
复制代码
  • 不用关心方向的 AppCollectionViewLayout
let layout = AppCollectionViewLayout(longitude: 0, latitude: 10.scale, itemSize: CGSize(width: 130.scale, height: 139.scale), sectionInset: .init(top: 10.scale, left: 20.scale, bottom: 0, right: 20.scale), direction: .vertical)
复制代码
  • 属性包裹器
/// codable👍
@Default<String.defalut> var name:String

/// 数据持久化👍
@UserDefault("had_shown_guide_view", defaultValue: false)
static var hadShownGuideView: Bool

复制代码
  • 系统页跳转
/// 跳转到系统页面
    /// - Parameter type: 类型
    /// - Parameter completionHandler:  block回调,bool表示是否成功
    static func systemJump(completionHandler completion: ((AppJumpStatus) -> Void)? = nil){
        let urlString = UIApplication.openSettingsURLString
        if let url: URL = URL(string: urlString) {
            App.jump(url: url, completionHandler: completion)
        }else{
            completion?(.fail)
        }
    }
复制代码
  • 增长经过cell上的控件获取cell、index
/// 获取indexpath
    func indexPath(by child:UIView)->IndexPath?{
        let point = child.convert(CGPoint.zero, to: self)
        return self.indexPathForRow(at: point)
    }
    /// 获取cell
    func cell(by child:UIView)->UITableViewCell?{
        let point = child.convert(CGPoint.zero, to: self)
        if let indexPath = self.indexPathForRow(at: point){
            return self.cellForRow(at: indexPath)
        }
        return nil
    }

复制代码
  • 其余
/// app版本号
    static var version: String? {
        return Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
    }
    /// 设备名称
    static var deviceName: String {
        return UIDevice.current.localizedModel
    }
    /// 设备方向
    static var deviceOrientation: UIDeviceOrientation {
        return UIDevice.current.orientation
    }
    /// 主窗口
    static var keyWindow: UIView? {
        return UIApplication.shared.keyWindow
    }
    /// 当前系统版本
    static var systemVersion: String {
        return UIDevice.current.systemVersion
    }
    /// 判断设备是否是iPhoneX
    static var isX : Bool {
        var isX = false
        if #available(iOS 11.0, *) {
            let bottom : CGFloat = UIApplication.shared.delegate?.window??.safeAreaInsets.bottom ?? 0
            isX = bottom > 0.0
        }
        return isX
    }
复制代码

等你发现更多······app

地址:github.com/Tliens/Spee… 欢迎使用,喜欢请star✨框架

结构介绍

我根据使用频率以及层次结构分为了:dom

  • O1_Base
  • O2_Core
  • O3_Foundation
  • O4_UI
  • O5_Vendor
  • O6_Resource

O1_Base 文件夹下包含 app跳转、沙盒使用、AppCollectionViewLayoutViewcontrolleNavigationControllerTabbarController 基础封装

O2_Core 属性包裹器、DebugRandom

O3_Foundation Foundation框架的经常使用扩展

O4_UI UIKit框架的经常使用扩展

O5_Vendor 强大的CPCollectionViewKit、震动反馈、Snapkit、Toast

O6_Resource 资源文件

地址:github.com/Tliens/Spee… 欢迎使用,喜欢请star✨

相关文章
相关标签/搜索