w2595503 / Moots

everything is the best arrangement

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Moots

github的markdown好像出了些问

常用代码

**UICollectionView highlight** ```swift // 方法一 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>
```swift
protocol ArrayPresenter {
    associatedtype ViewType: UIScrollView
    var listView: ViewType! { set get }
}

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

}
**银行金额验证**
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
    }
}
**多标志符字符串分割**
let text = "abc,vfr.yyuu"
let set = CharacterSet(charactersIn: ",.")
print(text.components(separatedBy: set)) // ["abc", "vfr", "yyuu"]
**[匹配模式](http://swift.gg/2016/06/06/pattern-matching-4/)**
let age = 19
if 18...25 ~= age {
    print("条件满足")
}
同
if age >= 18 && age <= 25 {
    print("条件满足")
}
同
if case 18...25 = age {
    print("条件满足")
}
**单行代码**
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])
**[GCD map函数](http://moreindirection.blogspot.it/2015/07/gcd-and-parallel-collections-in-swift.html)**
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 }
    }
}
**导航栏标题设置**
// 需要tabBarItem的title与导航栏title不一致,如下设置navigationbar的titile
navigationItem.title = "示例"
注意: 直接 title = "示例" 在tabbar切换时tabBarItem的title会变成设置
**tabbar隐藏动画(同知乎)**
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
}
**导航栏标返回图片** ```swift navigationBar.backIndicatorTransitionMaskImage = R.image.ic_nav_back() navigationBar.backIndicatorImage = R.image.ic_nav_back() ```
**[tableView分割线左边到头](http://www.jianshu.com/p/4e9619483035)(_UITableViewCellSeparatorView)** ```swift //写在viewDidLoad http://www.jianshu.com/p/1274343055a7 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>
```swift
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)
}
**部分圆角图片** ```swift 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 } ```
**圆角图片([AlamofireImage](https://github.com/Alamofire/AlamofireImage)里面有切圆角的方法)** ```swift 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>
```swift
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()
    }
}
**修改状态栏背景颜色** ```swift 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 } ```
**裁剪图片** ```swift 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>
```swift
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
    }
}

笔记

项目图片PDF

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的。
首先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的实例,使用无主引用。


优化


常用配置

**Cocoapods[原理](https://objccn.io/issue-6-4/)**
卸载当前版本
sudo gem uninstall cocoapods

下载旧版本
sudo gem install cocoapods -v 0.25.0
**修改Xcode自动生成的文件注释来导出API文档** ``` http://www.jianshu.com/p/d0c7d9040c93 open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/File\ Templates/Source ```
 **LLDB(断点调试)**
**删除多余模拟器**
open /Library/Developer/CoreSimulator/Profiles/Runtimes
open /Users/你电脑的名字/Library/Developer/Xcode/iOS\ DeviceSupport
**修改swift文件**
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

错误处理

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

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

其他


常用库

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

UI

    代码规范(Swift代码格式和自动格式化库)
**控件库(里面有你所需要的各种控件)**
**各种图表库(chart)**
**颜色**
**视频播放器**
**加载动画(loading)**
**TableView展开cell**
**日历**
**日期处理**
**约束**
**滚动导航栏**
**类似微信支付弹出一个UIViewController**
**转场动画**
**陌陌卡片的喜欢和不喜欢**
**气泡弹框**
**Swift的扩展**
**[10Clock](https://github.com/joedaniels29/10Clock)(Swift)** 这个控件是一个美丽的时间选择器大量启发的iOS 10“睡前”定时器。
**[AImage](https://github.com/wangjwchn/AImage)** Swift中的iOS的动画gif&apng引擎。 针对多图像情况进行了优化。
**Alert**
**[AKPickerView](https://github.com/Akkyie/AKPickerView-Swift)(Swift)** 一个简单但可自定义的水平选择器视图。
**[ASProgressPopUpView](https://github.com/alskipp/ASProgressPopUpView)(OC)** 显示弹出式视图中完成百分比的进度视图
**[ALCameraViewController](https://github.com/AlexLittlejohn/ALCameraViewController)(Swift)** 具有自定义图像选择器和图像裁剪的摄像机视图控制器。
**[BabyBluetooth](https://github.com/coolnameismy/BabyBluetooth)(OC)** 蓝牙
**[BouncyPageViewController](https://github.com/BohdanOrlov/BouncyPageViewController)(Swift)** 具有跳动效果的页面视图控制器
**[BubbleTransition](https://github.com/andreamazz/BubbleTransition)(Swift)** 一种自定义转换,用于展开和消除具有膨胀的气泡效应的控制器。
**[CardAnimation](https://github.com/seedante/CardAnimation)(Swift)** 卡片动画
**[CountdownLabel](https://github.com/suzuki-0000/CountdownLabel)(Swift)** 简单倒计时UILabel与变形动画,以及一些有用的功能。
**[ConfettiView](https://github.com/OrRon/ConfettiView)(Swift)** ConfettiView可以在您的应用程序中创建一个炫酷的五彩纸屑视图
**[DateTimePicker](https://github.com/itsmeichigo/DateTimePicker)(Swift)** 日期和时间选择组件
**[DGElasticPullToRefresh](https://github.com/gontovnik/DGElasticPullToRefresh)(Swift)** 带皮筋效果的下拉刷新
**[DisplaySwitcher](https://github.com/Yalantis/DisplaySwitcher)(Swift)** 两个集合视图布局之间的自定义转换
**[DOFavoriteButton](https://github.com/okmr-d/DOFavoriteButton)(Swift)** 点赞按钮
**[DKImagePickerController](https://github.com/zhangao0086/DKImagePickerController)(Swift)** 图片选择器
**[DZNEmptyDataSet](https://github.com/dzenbot/DZNEmptyDataSet)(OC)** 用于在视图没有要显示的内容时显示空数据集的UITableView / UICollectionView超类类别
**[ElasticTransition](https://github.com/lkzhao/ElasticTransition)(Swift)** 模拟弹性拖动的UIKit自定义转场。
**[ESTMusicIndicator](https://github.com/Aufree/ESTMusicIndicator)(Swift)** 音乐播放指示器
**[FaceAware](https://github.com/BeauNouvelle/FaceAware)(Swift)** 头像裁剪,使人脸居中
**[FDFullscreenPopGesture](https://github.com/forkingdog/FDFullscreenPopGesture)(OC)** 全屏返回
**[FloatLabelFields](https://github.com/FahimF/FloatLabelFields)(Swift)** placeholder会上浮的field
**[FontAwesomeKit](https://github.com/PrideChung/FontAwesomeKit)(OC)** 各种icon
**[ForceBlur](https://github.com/Yalantis/ForceBlur)(Swift)** ForceBlur动画iOS消息应用程序
**[GPUImage2](https://github.com/BradLarson/GPUImage2)** GPUImage 2是一个BSD授权的Swift框架,用于GPU加速的视频和图像处理。
**[GSMessages](https://github.com/wxxsw/GSMessages)(Swift)** navigationbar下面出来的提示框
**[HamburgerButton](https://github.com/fastred/HamburgerButton)(Swift)** 有转场动画的按钮
**[HGCircularSlider](https://github.com/HamzaGhazouani/HGCircularSlider)(Swift)** iOS应用程序的自定义可重复使用的圆形滑块控件。
**[iOS-Core-Animation-Advanced-Techniques](https://github.com/kevinzhow/iOS-Core-Animation-Advanced-Techniques)** CAlayer子类及动画的介绍
**[IGListKit](https://github.com/Instagram/IGListKit)(OC)** 一个数据驱动的UICollectionView框架,用于构建快速灵活的列表
**[JDStatusBarNotification](https://github.com/calimarkus/JDStatusBarNotification)(OC)** 状态栏通知
**[Jelly](https://github.com/SebastianBoldt/Jelly)(Swift)** Jelly在iOS中提供了自定义视图控制器转换,只需几行代码
**[JSQMessagesViewController](https://github.com/jessesquires/JSQMessagesViewController)(OC)** 一个优雅的消息UI库的iOS
**[JVFloatLabeledTextField](https://github.com/Grouper/FlatUIKit)(OC)** 上浮Field
**[JZNavigationExtension](https://github.com/JazysYu/JZNavigationExtension)(OC)** 网页导航栏过度效果
**[KMCGeigerCounter](https://github.com/kconner/KMCGeigerCounter)(OC)** FPS显示
**[KMNavigationBarTransition](https://github.com/MoZhouqi/KMNavigationBarTransition)(OC)** 美团首页,微信红包页面NavigationBar过度处理
**[KVOController](https://github.com/coolnameismy/BabyBluetooth)(OC)** 简单,现代,线程安全的键值观察iOS和OS X.
**[KYDrawerController](https://github.com/ykyouhei/KYDrawerController)(Swift)** 侧滑
**[LTHRadioButton](https://github.com/rolandleth/LTHRadioButton)(Swift)** 一个有漂亮动画的单选按钮
**[LiquidFloatingActionButton](https://github.com/yoavlt/LiquidFloatingActionButton)(Swift)** 浮动按钮
**[MLEmojiLabel](https://github.com/molon/MLEmojiLabel)(OC)** 自动识别网址、号码、邮箱、@、#话题#和表情的label。 可以自定义自己的表情识别正则,和对应的表情图像。(默认是识别微信的表情符号)
**[PageControls](https://github.com/popwarsweet/PageControls)** 各种PageControl
**[Panoramic](https://github.com/iSame7/Panoramic)(Swift)** 重力感应控制图片
**[PermissionScope](https://github.com/nickoneill/PermissionScope)(Swift)** 各种权限设置
**[Persei](https://github.com/Yalantis/Persei)(Swift)** 用Swift编写的UITableView / UICollectionView / UIScrollView的动画顶层菜单
**[M13ProgressSuite](https://github.com/Marxon13/M13ProgressSuite)(OC)** 进度指示器
**[MediumScrollFullScreen](https://github.com/pixyzehn/MediumScrollFullScreen)(Swift)** 滚动隐藏NavigationBar和ToolBar
**[MotionBlur](https://github.com/fastred/MotionBlur)** MotionBlur允许您为iOS动画添加运动模糊效果。
**[MXScrollView](https://github.com/cwxatlm/MXScrollView)(OC)** 一款易用的可拉伸的自动循环滚动视图 集成简单易懂 自定义性强
**[NextGrowingTextView](https://github.com/muukii/NextGrowingTextView)(Swift)** 自适应高度的TextView
**[PhoneNumberKit](https://github.com/marmelroy/PhoneNumberKit)(Swift)** 用于解析,格式化和验证国际电话号码的Swift框架。 灵感来自Google的libphonenumber。
**[PySwiftyRegex](https://github.com/cezheng/PySwiftyRegex)(Swift)** 轻松地以一种Pythonic方式处理Swift中的Regex
**[Reactions](https://github.com/yannickl/Reactions)(Swift)** 可定制的Facebook反应控件
**[RHPreviewCell](https://github.com/robertherdzik/RHPreviewCell)(Swift)** 长按显示隐藏图片
**[Ruler](https://github.com/nixzhu/Ruler)(Swift)** 尺寸很重要,你需要一把尺子。
**[RazzleDazzle](https://github.com/IFTTT/RazzleDazzle)(Swift)** 一个简单的基于关键帧的动画框架的iOS,用Swift编写。 完美的滚动应用程序介绍。
**[ReadabilityKit](https://github.com/exyte/ReadabilityKit)** Swift中的新闻,文章和全文的预览提取器
**[SFFocusViewLayout](https://github.com/fdzsergio/SFFocusViewLayout)(Swift)** UICollectionViewLayout炫酷的布局
**[Siren](https://github.com/ArtSabintsev/Siren)(Swift)** 当有新版本的应用程式可用时通知使用者,并提示他们升级
**[SKPhotoBrowser](https://github.com/suzuki-0000/SKPhotoBrowser)(Swift)** 照片浏览器
**[Sonar](https://github.com/thefuntasty/Sonar)(Swift)** 雷达扫码视图
**[StarWars.iOS](https://github.com/Yalantis/StarWars.iOS)(Swift)** 这个组件实现过渡动画,将视图控制器破碎成小块
**[StatefulViewController](https://github.com/aschuch/StatefulViewController)(Swift)** 基于内容,加载,错误或空状态的占位符视图
**[SwiftIconFont](https://github.com/0x73/SwiftIconFont)(Swift)** 像设置字体一样设置图片的大小
**[SwiftMessages](https://github.com/SwiftKickMobile/SwiftMessages)** 一个非常灵活的消息栏为iOS写的Swift。
**[SwiftyUserDefaults](https://github.com/radex/SwiftyUserDefaults)** NSUserDefaults的现代Swift API
**[SwipeTableView](https://github.com/Roylee-ML/SwipeTableView)(OC)** 类似半糖、美丽说主页与QQ音乐歌曲列表布局效果,实现不同菜单的左右滑动切换,同时支持类似tableview的顶部工具栏悬停(既可以左右滑动,又可以上下滑动)。兼容下拉刷新,自定义 collectionview实现自适应 contentSize 还可实现瀑布流功能
**[TableFlip](https://github.com/mergesort/TableFlip)(Swift)** 一个更简单的方法来做酷UITableView动画!
**[TDBadgedCell](https://github.com/tmdvs/TDBadgedCell)(Swift)** 带小红点的cell
**[TextFieldEffects](https://github.com/raulriera/TextFieldEffects)(Swift)** 自定义UITextFields效果
**[TPKeyboardAvoiding](https://github.com/michaeltyson/TPKeyboardAvoiding)(OC)** 键盘弹出事件处理
**[TimelineTableViewCell](https://github.com/kf99916/TimelineTableViewCell)(Swift)** 时间轴
**[TTTAttributedLabel](https://github.com/TTTAttributedLabel/TTTAttributedLabel)(OC)** 带连接可点击的label
**[UploadImage](https://github.com/MillmanY/UploadImage)(Swift)** UIImageView的图片上传指示
**[Whisper](https://github.com/hyperoslo/Whisper)(Swift)** Whisper是一个组件,它将使显示消息和应用程序内通知的任务变得简单。 它里面有三个不同的视图
**[XFAssistiveTouch](https://github.com/xiaofei86/XFAssistiveTouch)(Swift)** 仿系统的小白点
**[XLActionController](https://github.com/xmartlabs/XLActionController)(Swift)** 完全可定制和可扩展的action sheet controller
**[ZFRippleButton](https://github.com/zoonooz/ZFRippleButton)(Swift)** 自定义UIButton效果灵感来自Google Material Design

**动画**
**[Hero](https://github.com/lkzhao/Hero)(Swift)** 动画库
**[Spring](https://github.com/MengTo/Spring)** 在Swift中简化iOS动画的库。

其他

**Timer(定时器)**
**引导页**
**OCR(图像识别)**
**界面跳转路由**
**Swift代码生成器**
**SVG**
**[Argo](https://github.com/thoughtbot/Argo)(Swift)** Swift的JSON转换
**[Async](https://github.com/duemunk/Async)(Swift)** 对GCD的封装
**[BluetoothKit](https://github.com/rhummelmose/BluetoothKit)(Swift)** 使用BLE在iOS / OSX设备之间轻松通信
**[BeeHive](https://github.com/alibaba/BeeHive)(OC)** 阿里开源的解耦库
**[DeepLinkKit](https://github.com/button/DeepLinkKit)(OC)** 精湛的路由匹配,基于块的方式来处理你的深层链接。
**[Design-Patterns-In-Swift](https://github.com/ochococo/Design-Patterns-In-Swift)(Swift)** 设计模式
**[FBMemoryProfiler](https://github.com/facebook/FBMemoryProfiler)(OC)** facebook开源的内存分析器
**[FileBrowser](https://github.com/marmelroy/FileBrowser)(Swift)** 文件浏览器
**[Google VR](https://github.com/googlevr/gvr-ios-sdk)** 谷歌VR
**[Kakapo](https://github.com/devlucky/Kakapo)(Swift)** 在Swift中动态模拟服务器行为和响应
**[LayerPlayer](https://github.com/singro/v2ex)** 探索Apple的Core Animation API的功能
**[Live](https://github.com/ltebean/Live)(Swift)** 直播
**[MLeaksFinder](https://github.com/Zepo/MLeaksFinder)(Swift)** 在开发时查找iOS应用中的内存泄漏。
**[NetworkEye](https://github.com/coderyi/NetworkEye)(OC)** 一个iOS网络调试库,它可以监控应用程序中的HTTP请求,并显示与请求相关的信息
**[Nuke](https://github.com/kean/Nuke)(Swift)** 强大的图像加载和缓存框架
**[Password-keyboard](https://github.com/liuchunlao/Password-keyboard)(OC)** 动态密码键盘
**[Peek](https://github.com/shaps80/Peek)(Swift)** Peek是一个开源库,允许您根据用户界面的规范指南轻松检查您的应用程序。 Peek可以被工程师,设计师和测试人员使用,允许开发人员花更多的时间在代码和更少的时间检查字体,颜色和布局是像素完美。
**[PNChart-Swift](https://github.com/kevinzhow/PNChart-Swift)** 一个简单而美丽的图表库用
**[SQLite.swift](https://github.com/stars)(Swift)** 数据库
**[socket.io-client-swift](https://github.com/socketio/socket.io-client-swift)(Swift)** socket连接
**[SwiftyAttributes](https://github.com/eddiekaiger/SwiftyAttributes)(Swift)** 富文本字符串处理
**[SwiftPlate](https://github.com/mergesort/TableFlip)(Swift)** 用命令行轻松生成跨平台Swift框架项目
**[XLPagerTabStrip](https://github.com/xmartlabs/XLPagerTabStrip)** 网易那种侧滑页面
**[ZLSwipeableViewSwift](https://github.com/zhxnlai/ZLSwipeableViewSwift)(Swift)** 一个简单的视图构建卡像界面灵感来自Tinder和Potluck。

框架

**[AsyncDisplayKit](https://github.com/facebook/AsyncDisplayKit)** facebook开源的界面优化框架
**及时通讯框架**
**测试框架**
**跨平台框架**
**[katana-swift](https://github.com/BendingSpoons/katana-swift)(Swift)** 跟ReSwift类似
**[ReSwift](https://github.com/ReSwift/ReSwift)** 似乎有点牛B,待仔细研究
**[RxSwift](https://github.com/ReactiveX/RxSwift)(Swift)** 响应式编程
**[StyleKit](https://github.com/146BC/StyleKit)(Swift)** 一个用Swift编写的强大的,易于使用的样式框架

APP源码

[ifanr](https://github.com/iCodeForever/ifanr) 高仿 爱范儿
**[kickstarter](https://github.com/kickstarter/ios-oss)(Swift)** 一个众筹平台的源码
**[RaceMe](https://github.com/enochng1/RaceMe)(Swift)** 关于跑步的
**[SelectionOfZhihu](https://github.com/sheepy1/SelectionOfZhihu)(Swift)** 知乎
**[v2ex](https://github.com/singro/v2ex)** v2ex客户端
**[Yep](https://github.com/CatchChat/Yep)** 一个社交软件,遇见天才

Demo

**[VVeboTableViewDemo](https://github.com/johnil/VVeboTableViewDemo)(OC)** 微博优化demo
**[SmileWeather](https://github.com/liu044100/SmileWeather)(OC)** 天气Demo
**[youtube-iOS](https://github.com/aslanyanhaik/youtube-iOS)(Swift)** youtube
**[MaskLayerDemo](https://github.com/huangboju?page=6&tab=stars)(Swift)** 各种遮罩使用
**[nuomi](https://github.com/lookingstars/nuomi)(OC)** 仿糯米

About

everything is the best arrangement

License:MIT License


Languages

Language:Objective-C 49.5%Language:Swift 40.0%Language:JavaScript 6.8%Language:Python 2.3%Language:Java 1.4%