From 035808e750a17caca5f36df6c8ef80b1a5e0658c Mon Sep 17 00:00:00 2001 From: Scott Wolchok Date: Fri, 8 Feb 2019 13:36:43 -0800 Subject: [PATCH] Don't call [UIDevice currentDevice] in +load Summary: sysctl should be faster. Reviewed By: timonus Differential Revision: D13981833 fbshipit-source-id: ae7a67d4eb69595441a4a66e0ef0a271762f77ce --- Source/IGListAdapter.m | 3 ++- Source/Internal/IGSystemVersion.h | 8 ++++++++ Source/Internal/IGSystemVersion.m | 16 ++++++++++++++++ ...ICollectionViewLayout+InteractiveReordering.m | 3 ++- 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 Source/Internal/IGSystemVersion.h create mode 100644 Source/Internal/IGSystemVersion.m diff --git a/Source/IGListAdapter.m b/Source/IGListAdapter.m index d06c1bcd..5c0e1645 100644 --- a/Source/IGListAdapter.m +++ b/Source/IGListAdapter.m @@ -10,6 +10,7 @@ #import #import #import +#import #import "IGListSectionControllerInternal.h" #import "IGListDebugger.h" @@ -26,7 +27,7 @@ - (void)dealloc { // on iOS 9 setting the dataSource has side effects that can invalidate the layout and seg fault - if ([[[UIDevice currentDevice] systemVersion] floatValue] < 9.0) { + if (!IGSystemVersionIsIOS9OrNewer()) { // properties are assign for #import #import +#import #import @@ -23,7 +24,7 @@ static void * kIGListAdapterKey = &kIGListAdapterKey; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ // interactive reordering does not exist prior to iOS 9 - if ([[[UIDevice currentDevice] systemVersion] floatValue] < 9.0) { + if (!IGSystemVersionIsIOS9OrNewer()) { return; }