开源库阅读笔记(未整理)

IGListAdapter 抽象UIConllectionView 为 一个个sections 对象 即 IGListSectionType, 称为 section controllers他们有着自己的 data source 和 delegate

Macros: 宏

attribute((objc_subclassing_restricted)) : 放到类声明前面, 这样这个类就不能被继承

  • Clang Attributes 黑魔法小记

注释中可以使用
@note 来补充说明
@since 2.0 做版本说明

UICollectionView 的数据源 和 代理 dataSource, delegate 在 iOS 9 之前 是 assign 修饰, 需要手动销毁, 必须在 dealloc 中手动 _collectionView.dataSource = nil ; _collectionView.delegate=nil;

NSAssert(condition, desc)
断言 , 如果条件为真, 则继续运行程序, 如果条件为假, 则输出错误描述 desc

  • 断言(NSAssert)的使用

  • 基础集合类
    NSMapTable, NSOrderedSet,NSHashTable, NSPointerFunctions,NSPointerArray , NSCache, NSIndexSet 等 类的介绍

设置 DataSource
调用 DataSource 代理
跟新列表对象, 更新 sectionController对象.

Chameleon

状态栏 字体颜色自动变化, 当背景色是暗色 字体颜色为白色, 背景色为亮色 字体颜色为黑色

NS_STRING_ENUM 会让OC 中的常量在swift 中当做 enum 使用

typedef NSString * DCDictionaryKey NS_STRING_ENUM;

DCDictionaryKey const DCDictionaryKeyTitle    = @"title"; 
DCDictionaryKey const DCDictionaryKeySubtitle = @"subtitle"; 
DCDictionaryKey const DCDictionaryKeyCount    = @"count";

可以自动转化为swift 代码 如下:

// DCDictionaryKey 變成了 enum 
enum DCDictionaryKey: String { 
    case title 
    case subtitle
    case count 
}
  • 初探 NS_STRING_ENUM

Improve NS_STRING_ENUM

Currently, global variables in objc can be made available as structs when accessing them in swift. Unfortunately this is a one way conversion.
NS_STRING_ENUM ---> struct NS_STRING_ENUM <-x- struct
What are your thoughts on adding swift support for the reverse?
In other words if we mark a struct/enum with an annotation, it becomes available to objective c as global strings.
@objc enum City: String { case NewYork = "New York" }
This can be ported over to Objective-c like this:
typedef NSString * City; static City const CityNewYork = @"New York";

你可能感兴趣的:(开源库阅读笔记(未整理))