Skip to content

Commit d30fbec

Browse files
committed
解决影响启动时间的问题
1 parent 3ead3c4 commit d30fbec

File tree

2 files changed

+24
-18
lines changed

2 files changed

+24
-18
lines changed

WRNavigationBar/WRNavigationBar.swift

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -971,15 +971,18 @@ public protocol WRFatherAwakeProtocol: class
971971
class NothingToSeeHere
972972
{
973973
static func harmlessFunction(){
974-
let typeCount = Int(objc_getClassList(nil, 0))
975-
let types = UnsafeMutablePointer<AnyClass?>.allocate(capacity: typeCount)
976-
let autoreleaseintTypes = AutoreleasingUnsafeMutablePointer<AnyClass>(types)
977-
objc_getClassList(autoreleaseintTypes, Int32(typeCount)) //获取所有的类
978-
for index in 0 ..< typeCount {
979-
(types[index] as? WRAwakeProtocol.Type)?.wrAwake() //如果该类实现了SelfAware协议,那么调用 awake 方法
980-
(types[index] as? WRFatherAwakeProtocol.Type)?.fatherAwake()
981-
}
982-
types.deallocate(capacity: typeCount)
974+
// let typeCount = Int(objc_getClassList(nil, 0))
975+
// let types = UnsafeMutablePointer<AnyClass?>.allocate(capacity: typeCount)
976+
// let autoreleaseintTypes = AutoreleasingUnsafeMutablePointer<AnyClass>(types)
977+
// objc_getClassList(autoreleaseintTypes, Int32(typeCount)) //获取所有的类
978+
// for index in 0 ..< typeCount {
979+
// (types[index] as? WRAwakeProtocol.Type)?.wrAwake() //如果该类实现了SelfAware协议,那么调用 awake 方法
980+
// (types[index] as? WRFatherAwakeProtocol.Type)?.fatherAwake()
981+
// }
982+
// types.deallocate(capacity: typeCount)
983+
UINavigationBar.wrAwake()
984+
UIViewController.wrAwake()
985+
UINavigationController.fatherAwake()
983986
}
984987
}
985988

WRNavigationBar_swift/WRNavigationBar_swift/WRNavigationBar/WRNavigationBar.swift

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -971,15 +971,18 @@ public protocol WRFatherAwakeProtocol: class
971971
class NothingToSeeHere
972972
{
973973
static func harmlessFunction(){
974-
let typeCount = Int(objc_getClassList(nil, 0))
975-
let types = UnsafeMutablePointer<AnyClass?>.allocate(capacity: typeCount)
976-
let autoreleaseintTypes = AutoreleasingUnsafeMutablePointer<AnyClass>(types)
977-
objc_getClassList(autoreleaseintTypes, Int32(typeCount)) //获取所有的类
978-
for index in 0 ..< typeCount {
979-
(types[index] as? WRAwakeProtocol.Type)?.wrAwake() //如果该类实现了SelfAware协议,那么调用 awake 方法
980-
(types[index] as? WRFatherAwakeProtocol.Type)?.fatherAwake()
981-
}
982-
types.deallocate(capacity: typeCount)
974+
// let typeCount = Int(objc_getClassList(nil, 0))
975+
// let types = UnsafeMutablePointer<AnyClass?>.allocate(capacity: typeCount)
976+
// let autoreleaseintTypes = AutoreleasingUnsafeMutablePointer<AnyClass>(types)
977+
// objc_getClassList(autoreleaseintTypes, Int32(typeCount)) //获取所有的类
978+
// for index in 0 ..< typeCount {
979+
// (types[index] as? WRAwakeProtocol.Type)?.wrAwake() //如果该类实现了SelfAware协议,那么调用 awake 方法
980+
// (types[index] as? WRFatherAwakeProtocol.Type)?.fatherAwake()
981+
// }
982+
// types.deallocate(capacity: typeCount)
983+
UINavigationBar.wrAwake()
984+
UIViewController.wrAwake()
985+
UINavigationController.fatherAwake()
983986
}
984987
}
985988

0 commit comments

Comments
 (0)