欢迎光临
我们一直在努力

Swift开发常用库 资料整理

建站超值云服务器,限时71元/月

Swift开发常用库 资料整理

项目介绍:

https://github.com/huangboju/Moots

Moots

everything is the best arrangement

常用代码

<details>
<summary>
UICollectionView highlight
</summary>

// 方法一
func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
        cell.backgroundColor = .white

        let backgroundView = UIView(frame: cell.frame)
        backgroundView.backgroundColor = UIColor(white: 0.9, alpha: 1)
        cell.selectedBackgroundView = backgroundView
}

func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
     collectionView.deselectItem(at: indexPath, animated: true)
}

// 方法二(有延时)
func collectionView(_ collectionView: UICollectionView, didHighlightItemAt indexPath: IndexPath) {
        let cell = collectionView.cellForItem(at: indexPath)
        cell?.contentView.backgroundColor = UIColor(white: 0.9, alpha: 1)
}

func collectionView(_ collectionView: UICollectionView, didUnhighlightItemAt indexPath: IndexPath) {
        let cell = collectionView.cellForItem(at: indexPath)
        cell?.contentView.backgroundColor = nil
}

</details>

<details>
<summary>
泛型约束
</summary>

protocol ArrayPresenter {
    associatedtype ViewType: UIScrollView
    var listView: ViewType! { set get }
}

func loadMore<T: UIScrollView>(listView: T, indexPath: NSIndexPath) where T: YourProtocol {

}

</details>

<details>
<summary>
银行金额验证
</summary>

extension String {
    func enteredCorrectly() -> Bool {
        if length == 0 {
            return false
        }
        let scan = NSScanner(string: self)
        let isNotZero = Double(self) > 0
        if isNotZero {
            if containsString(".") {
                if let rangeOfZero = rangeOfString(".", options: .BackwardsSearch) {
                    let suffix = String(characters.suffixFrom(rangeOfZero.endIndex))
                    if suffix.length > 2 {
                        showAlert(controller, message: "您输入的金额有误")
                        return false
                    }
                }
                var float: Float = 0
                guard !(scan.scanFloat(&float) && scan.atEnd) else { return true }
            } else {
                var int: Int64 = 0
                guard !(scan.scanLongLong(&int) && scan.atEnd) else { return true }
            }
        }
        return false
    }
}

</details>

<details>
<summary>
多标志符字符串分割
</summary>

let text = "abc,vfr.yyuu"
let set = CharacterSet(charactersIn: ",.")
print(text.components(separatedBy: set)) // ["abc", "vfr", "yyuu"]

</details>

<details>
<summary>
匹配模式
</summary>

let age = 19
if 18...25 ~= age {
    print("条件满足")
}
同
if age >= 18 && age <= 25 {
    print("条件满足")
}
同
if case 18...25 = age {
    print("条件满足")
}

</details>

<details>
<summary>
单行代码
</summary>

let arr = (1...1024).map{ $0 * 2 }


let n = (1...1024).reduce(0,combine: +)


let words = ["Swift","iOS","cocoa","OSX","tvOS"]
let tweet = "This is an example tweet larking about Swift"
let valid = !words.filter({ tweet.containsString($0) }).isEmpty
valid //true
let valid2 = words.contains(tweet.containsString)
valid2 //true


// 埃拉托斯特尼筛法
var n = 102
var primes = Set(2...n)
var sameprimes = Set(2...n)
let aa = sameprimes.subtract(Set(2...Int(sqrt(Double(n))))
    .flatMap{(2 * $0).stride(through: n, by:$0)})
let bb = aa.sort()
// bb [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101]


let arr = [82, 58, 76, 49, 88, 90]
let retulst = data.reduce(([], [])) {
    $1 < 60 ? ($0.0 + [$1], $0.1) : ($0.0, $0.1 + [$1])
}
// retulst ([58, 49], [82, 76, 88, 90])

</details>

<details>
<summary>
GCD map函数
</summary>

extension Array {
    public func pmap(transform: (Element -> Element)) -> [Element] {
        guard !self.isEmpty else {
            return []
        }

        var result: [(Int, [Element])] = []

        let group = dispatch_group_create()
        let lock = dispatch_queue_create("pmap queue for result", DISPATCH_QUEUE_SERIAL)

        let step: Int = max(1, self.count / NSProcessInfo.processInfo().activeProcessorCount) // step can never be 0

        for var stepIndex = 0; stepIndex * step < self.count; stepIndex += 1 {
            let capturedStepIndex = stepIndex

            var stepResult: [Element] = []
            dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
                for i in (capturedStepIndex * step)..<((capturedStepIndex + 1) * step) {
                    if i < self.count {
                        let mappedElement = transform(self[i])
                        stepResult += [mappedElement]
                    }
                }

                dispatch_group_async(group, lock) {
                    result += [(capturedStepIndex, stepResult)]
                }
            }
        }

        dispatch_group_wait(group, DISPATCH_TIME_FOREVER)

        return result.sort { $0.0 < $1.0 }.flatMap { $0.1 }
    }
}

extension Array {
    public func pfilter(includeElement: Element -> Bool) -> [Element] {
        guard !self.isEmpty else {
            return []
        }

        var result: [(Int, [Element])] = []

        let group = dispatch_group_create()
        let lock = dispatch_queue_create("pmap queue for result", DISPATCH_QUEUE_SERIAL)

        let step: Int = max(1, self.count / NSProcessInfo.processInfo().activeProcessorCount) // step can never be 0

        for var stepIndex = 0; stepIndex * step < self.count; stepIndex += 1 {
            let capturedStepIndex = stepIndex

            var stepResult: [Element] = []
            dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
                for i in (capturedStepIndex * step)..<((capturedStepIndex + 1) * step) {
                    if i < self.count && includeElement(self[i]) {
                        stepResult += [self[i]]
                    }
                }

                dispatch_group_async(group, lock) {
                    result += [(capturedStepIndex, stepResult)]
                }
            }
        }

        dispatch_group_wait(group, DISPATCH_TIME_FOREVER)

        return result.sort { $0.0 < $1.0 }.flatMap { $0.1 }
    }
}

</details>

<details>
<summary>
导航栏标题设置
</summary>

// 需要tabBarItem的title与导航栏title不一致,如下设置navigationbar的titile
navigationItem.title = "示例"
注意: 直接 title = "示例" 在tabbar切换时tabBarItem的title会变成设置

</details>

<details>
<summary>
tabbar隐藏动画(同知乎)
</summary>

func setTabBarVisible(visible: Bool, animated: Bool) {

//* This cannot be called before viewDidLayoutSubviews(), because the frame is not set before this time

// bail if the current state matches the desired state
if tabBarIsVisible == visible { return }

// get a frame calculation ready
let frame = tabBarController?.tabBar.frame
let height = frame?.size.height
let offsetY = (visible ? -height! : height)

// zero duration means no animation
let duration: NSTimeInterval = (animated ? 0.3 : 0.0)

//  animate the tabBar
if let rect = frame {
UIView.animateWithDuration(duration) {
self.tabBarController?.tabBar.frame = CGRectOffset(rect, 0, offsetY!)
return
}
}
}

var tabBarIsVisible: Bool {
return tabBarController?.tabBar.frame.minY < view.frame.maxY
}

</details>

<details>
<summary>
导航栏标返回图片
</summary>

navigationBar.backIndicatorTransitionMaskImage = R.image.ic_nav_back()
navigationBar.backIndicatorImage = R.image.ic_nav_back()

</details>

<details>
<summary>
tableView分割线左边到头(_UITableViewCellSeparatorView)
</summary>

//写在viewDidLoad
if tableView.respondsToSelector(Selector("setSeparatorInset:")) {
    tableView.separatorInset = UIEdgeInsetsZero
}
if tableView.respondsToSelector(Selector("setLayoutMargins:")) {
    tableView.layoutMargins = UIEdgeInsetsZero
}

//写在 willDisplayCell
if cell.respondsToSelector(Selector("setSeparatorInset:")) {
    cell.separatorInset = UIEdgeInsetsZero
}
if cell.respondsToSelector(Selector("setLayoutMargins:")) {
    cell.layoutMargins = UIEdgeInsetsZero
}

override func layoutSubviews() {
super.layoutSubviews()
separatorInset = UIEdgeInsetsZero
preservesSuperviewLayoutMargins = false
layoutMargins = UIEdgeInsetsZero
}

</details>

<details>
<summary>
虚线
</summary>

func drawDottedLine(lineView: UIView, offset: CGPoint) {
    let shapeLayer = CAShapeLayer()
    shapeLayer.bounds = lineView.bounds
    shapeLayer.position = lineView.layer.position
    shapeLayer.fillColor = nil
    shapeLayer.strokeColor = MOOTS_LINE_GRAY.CGColor
    shapeLayer.lineWidth = 0.5
    shapeLayer.lineJoin = kCALineJoinRound
    // 4=线的宽度 1=每条线的间距
    shapeLayer.lineDashPattern = [NSNumber(int: 4), NSNumber(int: 1)]
    let path = CGPathCreateMutable()
    CGPathMoveToPoint(path, nil, offset.x, offset.y)
    CGPathAddLineToPoint(path, nil, CGRectGetWidth(lineView.frame) - offset.x, offset.y)
    shapeLayer.path = path
    lineView.layer.addSublayer(shapeLayer)
}

</details>

<details>
<summary>
部分圆角图片
</summary>

func cornerImage(frame: CGRect, image: UIImage, Radii: CGSize) -> UIImageView {
    let imageView = UIImageView(image: image)
    imageView.frame = frame
    let bezierPath = UIBezierPath(roundedRect: imageView.bounds, byRoundingCorners: [.TopLeft, .TopRight], cornerRadii: Radii)
    let shapeLayer = CAShapeLayer()
    shapeLayer.path = bezierPath.CGPath
    imageView.layer.mask = shapeLayer
    return imageView
}

</details>

<details>
<summary>
圆角图片(AlamofireImage里面有切圆角的方法)
</summary>

extension UIImageView {

    func kt_addCorner(radius radius: CGFloat) {
        self.image = self.image?.kt_drawRectWithRoundedCorner(radius: radius, self.bounds.size)
    }
}

extension UIImage {
    func kt_drawRectWithRoundedCorner(radius radius: CGFloat, _ sizetoFit: CGSize) -> UIImage {
        let rect = CGRect(origin: CGPoint(x: 0, y: 0), size: sizetoFit)

        UIGraphicsBeginImageContextWithOptions(rect.size, false, UIScreen.mainScreen().scale)
        CGContextAddPath(UIGraphicsGetCurrentContext(),
            UIBezierPath(roundedRect: rect, byRoundingCorners: UIRectCorner.AllCorners,
                cornerRadii: CGSize(width: radius, height: radius)).CGPath)
        CGContextClip(UIGraphicsGetCurrentContext())

        self.drawInRect(rect)
        CGContextDrawPath(UIGraphicsGetCurrentContext(), .FillStroke)
        let output = UIGraphicsGetImageFromCurrentImageContext()
        UIGraphicsEndImageContext()

        return output
    }
}

</details>

<details>
<summary>
通过字符串构建类
</summary>

extension String {
    func fromClassName() -> NSObject {
        let className = NSBundle.mainBundle().infoDictionary!["CFBundleName"] as! String + "." + self
        let aClass = NSClassFromString(className) as! UIViewController.Type
        return aClass.init()
    }
}

extension NSObject {
    class func fromClassName(className: String) -> NSObject {
        let className = NSBundle.mainBundle().infoDictionary!["CFBundleName"] as! String + "." + className
        let aClass = NSClassFromString(className) as! UIViewController.Type
        return aClass.init()
    }
}

</details>

<details>
<summary>
修改状态栏背景颜色
</summary>

func setStatusBarBackgroundColor(color: UIColor) {
    guard  let statusBar = UIApplication.sharedApplication().valueForKey("statusBarWindow")?.valueForKey("statusBar") as? UIView else {
        return
    }
    statusBar.backgroundColor = color
}
swift3.0
    func setStatusBarBackgroundColor(color: UIColor) {
        let statusBarWindow = UIApplication.shared.value(forKey: "statusBarWindow") as? UIView
        guard  let statusBar = statusBarWindow?.value(forKey: "statusBar") as? UIView else {
            return
        }
        statusBar.backgroundColor = color
    }

</details>

<details>
<summary>
裁剪图片
</summary>

extension UIImage {
    func cutOutImageWithRect(rect: CGRect) -> UIImage {

        guard let subImageRef = CGImageCreateWithImageInRect(CGImage, rect) else {
            return self
        }
        let smallBounds = CGRect(x: 0, y: 0, width: CGImageGetWidth(subImageRef), height: CGImageGetHeight(subImageRef))
        UIGraphicsBeginImageContext(smallBounds.size)
        let context = UIGraphicsGetCurrentContext()
        CGContextDrawImage(context, smallBounds, subImageRef)
        let smallImage = UIImage(CGImage: subImageRef)
        UIGraphicsEndImageContext()
        return smallImage
    }
}

</details>

<details>
<summary>
UIButton响应区域太小
</summary>

extension UIButton {
    //处理button太小
    open override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
        // if the button is hidden/disabled/transparent it can't be hit
        if self.isHidden || !self.isUserInteractionEnabled || self.alpha < 0.01 { return nil }
        // increase the hit frame to be at least as big as `minimumHitArea`
        let buttonSize = bounds.size
        let widthToAdd = max(44 - buttonSize.width, 0)
        let heightToAdd = max(44 - buttonSize.height, 0)
        let largerFrame = bounds.insetBy(dx: -widthToAdd / 2, dy: -heightToAdd / 2)
        // perform hit test on larger frame
        return largerFrame.contains(point) ? self : nil
    }
}

</details>


笔记

项目图片PDF

  • https抓包

  • IAP(内购)

    • 开始

    • 参考

    • 二次验证流程

  • NSURLCache(缓存)(http://nshipster.cn/nsurlcache/)

Alamofire零行代码实现离线缓存http://stackoverflow.com/questions/27785693/alamofire-nsurlcache-is-not-working
  • UIImage

UIImage(named: "imageName")// caching 
UIImage(contentsOfFile: "imageName")// no caching 
如果你要加载一个大图片而且是一次性使用,那么就没必要缓存这个图片,用contentsOfFile足矣,这样不会浪费内存来缓存它。
然而,在图片反复重用的情况下named是一个好得多的选择。
  • UITableView

在UITableViewCell实例上添加子视图,有两种方式:[cell  addSubview:view]或[cell.contentView addSubview:view],一般情况下,两种方式没有区别。但是在多选编辑状态,直接添加到cell上的子视图将不会移动,而添加在contentView上的子视图会随着整体右移。所以,推荐使用[cell.contentView addSubview:view]方式添加子视图。

cell.backgroundColor = [UIColor grayColor];或cell.contentView.backgroudColor = [UIColor grayColor];一般情况下,两种方式效果一样。但是在多选编辑状态,直接设置cell的背景色可以保证左侧多选框部分的背景色与cell背景色一致,而设置contentView背景色,左侧多选框的背景色会是UITableView的背景色或UITableView父视图背景色,如果需要保证颜色一致,必须设置cell的背景色而不是cell.contentView的。
  • iOS事件响应链中Hit-Test View的应用

  • UIButton setImage setBackgroundImage

首先setBackgroundImage,image会随着button的大小而改变,图片自动会拉伸来适应button的大小,这个时候任然可以设置button的title,image不会挡住title;相反的的setImage,图片不会进行拉伸,原比例的显示在button上,此时再设置title,title将无法显示,因此可以根据需求选中方法
  • NSLayoutConstraint Leading left

NSLayoutAttributeLeading/NSLayoutAttributeTrailing的区别是left/right永远是指左右,
leading/trailing在某些从右至左习惯的地区(希伯来语等)会变成,leading是右边,trailing是左边
  • Protocol

delegate一般得用weak标识符,这样当delegate指向的controller被销毁时,delegate会跟着被置为nil,可以有效防止这种问题。
若是使用assign标识的delegate,则注意在delegate指向的对象被销毁时,将delegate 置为nil。
也有不将delegate置为nil,没有问题的情况。如常见的tableView,其delegate和datasource,一般不会在其他controller中使用该tableView,所以不会有这种问题。
  • Struct

实例方法中修改值类型
结构体和枚举是值类型。默认情况下,值类型的属性不可以在他的实例方法中修改
可以用mutating(变异行为)
注意:不能在结构体类型常量上调用变异方法,因为常量的属性不能被改变,即使想改变的是常量的变量属性也不行
    • Self 表示引用当前实例的类型

    • AnyObject可以代表任何class类型的实例

    • Any可以表示任何类型。除了方法类型(function types)

    • 对于生命周期中会变为nil的实例使用弱引用。相反地,对于初始化赋值后再也不会被赋值为nil的实例,使用无主引用。


优化

  • UIKit性能调优实战讲解

  • UITableView

  • AsyncDisplayKit教程

  • 使用 ASDK 性能调优 – 提升 iOS 界面的渲染性能


常用配置

<details>
<summary>
Cocoapods(原理)
</summary>

卸载当前版本
sudo gem uninstall cocoapods

下载旧版本
sudo gem install cocoapods -v 0.25.0

</details>

<details>
<summary>
修改Xcode自动生成的文件注释来导出API文档
</summary>

http://www.jianshu.com/p/d0c7d9040c93
open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/File\ Templates/Source

</details>

<details>
<summary>
删除多余模拟器
</summary>

open /Library/Developer/CoreSimulator/Profiles/Runtimes
open /Users/你电脑的名字/Library/Developer/Xcode/iOS\ DeviceSupport

</details>

<details>
<summary>
修改swift文件
</summary>

open /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File\ Templates/Source/Swift\ File.xctemplate

open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/File\ Templates/Source/Cocoa\ Touch\ Class.xctemplate/UIViewControllerSwift

</details>


错误处理

1.The certificate used to sign “XXX” has either expired or has been revoked

  • 解决方法

  • 然后

2.解决cocoapods diff: /../Podfile.lock: No such file or directory

  • 解决方法1

  • 解决方法2

其他

markdown语法

public podspec

private podspec

podfile 锁定版本

Swift runtime

Xcode快捷键

理解UIView的绘制

切换淘宝源

卸载cocoapods


常用库

按字母排序,点击展开为该库的描述

UI

<details>
<summary>视频播放器</summary>

<ul>
<li>[BMPlayer](https://github.com/BrikerMan/BMPlayer)(Swift)</li>
<li>[MobilePlayer](https://github.com/mobileplayer/mobileplayer-ios)(Swift)(Swift)</li>
</ul>

</details>

<details>
<summary>日历</summary>

<ul>
  <li>[GLCalendarView](https://github.com/Glow-Inc/GLCalendarView)(OC)</li>
  <li>[JTCalendar](https://github.com/jonathantribouharet/JTCalendar)(OC)</li>
  <li>[FSCalendar](https://github.com/WenchaoD/FSCalendar)(Swift)</li>
  <li>[JTAppleCalendar](https://github.com/patchthecode/JTAppleCalendar)(Swift)</li>
</ul>

</details>

<details>
<summary>日期处理</summary>

<ul>
  <li>[Timepiece](https://github.com/naoty/Timepiece)(Swift)</li>
  <li>[DateTools](https://github.com/MatthewYork/DateTools)(OC/Swift)</li>
</ul>

</details>

<details>
<summary>约束</summary>

<ul>
  <li>[SnapKit](https://github.com/SnapKit/SnapKit)(Swift)</li>
  <li>[PureLayout](https://github.com/PureLayout/PureLayout)(OC)</li>
</ul>

</details>

<details>
<summary>
10Clock(Swift)
</summary>
这个控件是一个美丽的时间选择器大量启发的iOS 10“睡前”定时器。
</details>

<details>
<summary>Alert</summary>

<ul>
  <li>[CDAlertView](https://github.com/candostdagdeviren/CDAlertView)(Swift)</li>
  <li>[Presentr](https://github.com/IcaliaLabs/Presentr)(Swift)</li>
</ul>

</details>

<details>
<summary>
AKPickerView(Swift)
</summary>
一个简单但可自定义的水平选择器视图。
</details>

<details>
<summary>
ASProgressPopUpView(OC)
</summary>
显示弹出式视图中完成百分比的进度视图
</details>

<details>
<summary>
ALCameraViewController(Swift)
</summary>
具有自定义图像选择器和图像裁剪的摄像机视图控制器。
</details>

<details>
<summary>
BouncyPageViewController(Swift)
</summary>
具有跳动效果的页面视图控制器
</details>

<details>
<summary>
ConfettiView(Swift)
</summary>
ConfettiView可以在您的应用程序中创建一个炫酷的五彩纸屑视图
</details>

<details>
<summary>
DateTimePicker(Swift)
</summary>
日期和时间选择组件
</details>

<details>
<summary>
DZNEmptyDataSet(OC)
</summary>
用于在视图没有要显示的内容时显示空数据集的UITableView / UICollectionView超类类别
</details>

<details>
<summary>
FDFullscreenPopGesture(OC)
</summary>
全屏返回
</details>

<details>
<summary>
FontAwesomeKit(OC)
</summary>
各种icon
</details>

<details>
<summary>
ForceBlur(Swift)
</summary>
ForceBlur动画iOS消息应用程序
</details>

<details>
<summary>
GSMessages(Swift)
</summary>
navigationbar下面出来的提示框
</details>

<details>
<summary>
HGCircularSlider(Swift)
</summary>
iOS应用程序的自定义可重复使用的圆形滑块控件。
</details>

<details>
<summary>
IGListKit(OC)
</summary>
一个数据驱动的UICollectionView框架,用于构建快速灵活的列表
</details>

<details>
<summary>
Jelly(Swift)
</summary>
Jelly在iOS中提供了自定义视图控制器转换,只需几行代码
</details>

<details>
<summary>
KMCGeigerCounter(OC)
</summary>
FPS显示
</details>

<details>
<summary>
KMNavigationBarTransition(OC)
</summary>
美团首页,微信红包页面NavigationBar过度处理
</details>

<details>
<summary>
KYDrawerController(Swift)
</summary>
侧滑
</details>

<details>
<summary>
LTHRadioButton(Swift)
</summary>
一个有漂亮动画的单选按钮
</details>

<details>
<summary>
Persei(Swift)
</summary>
用Swift编写的UITableView / UICollectionView / UIScrollView的动画顶层菜单
</details>

<details>
<summary>
PhoneNumberKit(Swift)
</summary>
用于解析,格式化和验证国际电话号码的Swift框架。 灵感来自Google的libphonenumber。
</details>

<details>
<summary>
QMUI_iOS(OC)
</summary>
腾讯开源的控件库
</details>

<details>
<summary>
MaterialComponents(OC)
</summary>
 谷歌控件库
</details>

<details>
<summary>
MXScrollView(OC)
</summary>
一款易用的可拉伸的自动循环滚动视图 集成简单易懂 自定义性强
</details>

<details>
<summary>
MZFormSheetController(OC)
</summary>
MZFormSheetController提供了一个替代本地iOS UIModalPresentationFormSheet,添加对iPhone的支持和额外的机会来设置控制器大小和感觉表单。
</details>

<details>
<summary>
NextGrowingTextView(Swift)
</summary>
自适应高度的TextView
</details>

<details>
<summary>
Reactions(Swift)
</summary>
可定制的Facebook反应控件
</details>

<details>
<summary>
RHPreviewCell(Swift)
</summary>
长按显示隐藏图片
</details>

<details>
<summary>
Ruler(Swift)
</summary>
尺寸很重要,你需要一把尺子。
</details>

<details>
<summary>
StatefulViewController(Swift)
</summary>
基于内容,加载,错误或空状态的占位符视图
</details>

<details>
<summary>
SwipeTableView(OC)
</summary>
类似半糖、美丽说主页与QQ音乐歌曲列表布局效果,实现不同菜单的左右滑动切换,同时支持类似tableview的顶部工具栏悬停(既可以左右滑动,又可以上下滑动)。兼容下拉刷新,自定义 collectionview实现自适应 contentSize 还可实现瀑布流功能
</details>

<details>
<summary>
TableFlip(Swift)
</summary>
一个更简单的方法来做酷UITableView动画!
</details>

<details>
<summary>
TextFieldEffects(Swift)
</summary>
自定义UITextFields效果
</details>

<details>
<summary>
TimelineTableViewCell(Swift)
</summary>
时间轴
</details>

<details>
<summary>
TinderSimpleSwipeCards(OC)
</summary>
类似陌陌卡片选择
</details>

动画

<details>
<summary>
Hero(Swift)
</summary>
动画库
</details>

数据库

<details>
<summary>
SQLite.swift(Swift)
</summary>
类似陌陌卡片选择
</details>

其他

<details>
<summary>Timer(定时器)</summary>

<ul>
<li>[Each](https://github.com/IcaliaLabs/Presentr)(Swift)</li>
<li>[SwiftTimer](https://github.com/100mango/SwiftTimer)(Swift)</li>
</ul>

</details>

<details>
<summary>引导页</summary>

<ul>
<li>[EAIntroView](https://github.com/ealeksandrov/EAIntroView)(OC)</li>
</ul>

</details>

<details>
<summary>OCR(图像识别)</summary>

<ul>
  <li>[SwiftOCR](https://github.com/garnele007/SwiftOCR)(Swift)</li>
  <li>[OCR](https://github.com/iosWellLin/OCR)(OC)</li>
</ul>

</details>

<details>
<summary>界面跳转路由</summary>

<ul>
  <li>[DCURLRouter](https://github.com/DarielChen/DCURLRouter)(OC)</li>
  <li>[FNUrlRoute](https://github.com/Fnoz/FNUrlRoute)(Swift)</li>
</ul>

</details>

<details>
<summary>Swift代码生成器</summary>

<ul>
  <li>[SwiftGen](https://github.com/johnil/VVeboTableViewDemo)(Swift)</li>
  <li>[R.swift](https://github.com/mac-cain13/R.swift)(Swift)</li>
</ul>

</details>

<details>
<summary>SVG</summary>

<ul>
  <li>[Snowflake](https://github.com/onmyway133/Snowflake)(Swift)</li>
  <li>[Macaw](https://github.com/exyte/Macaw)(Swift)</li>
</ul>

</details>

<details>
<summary>
Argo(Swift)
</summary>
Swift的JSON转换
</details>

<details>
<summary>
BeeHive(OC)
</summary>
阿里开源的解耦库
</details>

<details>
<summary>
FileBrowser(Swift)
</summary>
文件浏览器
</details>

<details>
<summary>
Google VR
</summary>
谷歌VR
</details>

<details>
<summary>
LayerPlayer
</summary>
探索Apple的Core Animation API的功能
</details>

<details>
<summary>
Live(Swift)
</summary>
直播
</details>

<details>
<summary>
MLeaksFinder(Swift)
</summary>
在开发时查找iOS应用中的内存泄漏。
</details>

<details>
<summary>
Nuke(Swift)
</summary>
强大的图像加载和缓存框架
</details>

<details>
<summary>
Password-keyboard(OC)
</summary>
动态密码键盘
</details>

<details>
<summary>
Peek(Swift)
</summary>
Peek是一个开源库,允许您根据用户界面的规范指南轻松检查您的应用程序。 Peek可以被工程师,设计师和测试人员使用,允许开发人员花更多的时间在代码和更少的时间检查字体,颜色和布局是像素完美。
</details>

<details>
<summary>
SwiftyAttributes(Swift)
</summary>
富文本字符串处理
</details>

<details>
<summary>
SwiftPlate(Swift)
</summary>
用命令行轻松生成跨平台Swift框架项目
</details>

<details>
<summary>
SwifterSwift(Swift)
</summary>
Swift各个类的扩展
</details>

框架

<details>
<summary>测试框架</summary>

<ul>
<li>[Quick](https://github.com/Quick/Quick)(Swift)</li>
  <li>[SwiftCheck](https://github.com/typelift/SwiftCheck)(Swift)</li>
</ul>

</details>

<details>
<summary>跨平台框架</summary>

<ul>
  <li>[weex](https://github.com/alibaba/weex)</li>
  <li>[react-native](https://github.com/facebook/react-native)(Swift)</li>
</ul>

</details>

<details>
<summary>
katana-swift(Swift)
</summary>
跟ReSwift类似
</details>

<details>
<summary>
ReSwift
</summary>
似乎有点牛B,待仔细研究
</details>

<details>
<summary>
RxSwift(Swift)
</summary>
响应式编程
</details>

APP源码

<details>
<summary>
kickstarter(Swift)
</summary>
一个众筹平台的源码
</details>

<details>
<summary>
v2ex
</summary>
v2ex客户端
</details>

Demo

<details>
<summary>
VVeboTableViewDemo(OC)
</summary>
微博优化demo
</details>

<details>
<summary>
SmileWeather(OC)
</summary>
天气Demo
</details>

code4app

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » Swift开发常用库 资料整理
分享到: 更多 (0)