Przeglądaj źródła

Add missing availability guards

Tanner Bennett 6 lat temu
rodzic
commit
4d019046bc

+ 11 - 2
Classes/Core/FLEXScopeCarousel.m

@@ -33,6 +33,11 @@ NSString * const kCarouselCellReuseIdentifier = @"kCarouselCellReuseIdentifier";
         self.backgroundColor = [FLEXColor primaryBackgroundColor];
         self.autoresizingMask = UIViewAutoresizingFlexibleWidth;
         _dynamicTypeHandlers = [NSMutableArray new];
+        
+        CGSize itemSize = CGSizeZero;
+        if (@available(iOS 10.0, *)) {
+            itemSize = UICollectionViewFlowLayoutAutomaticSize;
+        }
 
         // Collection view layout
         UICollectionViewFlowLayout *layout = ({
@@ -40,8 +45,8 @@ NSString * const kCarouselCellReuseIdentifier = @"kCarouselCellReuseIdentifier";
             layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
             layout.sectionInset = UIEdgeInsetsZero;
             layout.minimumLineSpacing = kCarouselItemSpacing;
-            layout.itemSize = UICollectionViewFlowLayoutAutomaticSize;
-            layout.estimatedItemSize = UICollectionViewFlowLayoutAutomaticSize;
+            layout.itemSize = itemSize;
+            layout.estimatedItemSize = itemSize;
             layout;
         });
 
@@ -161,6 +166,10 @@ NSString * const kCarouselCellReuseIdentifier = @"kCarouselCellReuseIdentifier";
 #pragma mark - UICollectionView
 
 - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
+//    if (@available(iOS 10.0, *)) {
+//        return UICollectionViewFlowLayoutAutomaticSize;
+//    }
+    
     self.sizingCell.title = self.items[indexPath.item];
     return [self.sizingCell systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
 }

+ 3 - 1
Classes/GlobalStateExplorers/FLEXWebViewController.m

@@ -25,7 +25,9 @@
     if (self) {
         WKWebViewConfiguration *configuration = [WKWebViewConfiguration new];
 
-        configuration.dataDetectorTypes = UIDataDetectorTypeLink;
+        if (@available(iOS 10.0, *)) {
+            configuration.dataDetectorTypes = UIDataDetectorTypeLink;
+        }
 
         self.webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:configuration];
         self.webView.navigationDelegate = self;

+ 2 - 0
FLEX.xcodeproj/project.pbxproj

@@ -1365,6 +1365,7 @@
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";
 				SKIP_INSTALL = YES;
+				WARNING_CFLAGS = "-Wno-unsupported-availability-guard";
 			};
 			name = Debug;
 		};
@@ -1392,6 +1393,7 @@
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";
 				SKIP_INSTALL = YES;
+				WARNING_CFLAGS = "-Wno-unsupported-availability-guard";
 			};
 			name = Release;
 		};