Skip to content

Commit

Permalink
Make it work with app extensions by dropping iOS 9 support
Browse files Browse the repository at this point in the history
  • Loading branch information
lammertw committed Sep 9, 2019
1 parent 51b98a8 commit df9bb70
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 23 deletions.
4 changes: 2 additions & 2 deletions BonMot.podspec
Expand Up @@ -13,10 +13,10 @@ Pod::Spec.new do |s|
s.social_media_url = 'https://twitter.com/ZevEisenberg'
s.requires_arc = true

s.ios.deployment_target = '9.0'
s.ios.deployment_target = '10.0'
s.ios.source_files = 'Sources/**/*.swift'

s.tvos.deployment_target = '9.0'
s.tvos.deployment_target = '10.0'
s.tvos.source_files = 'Sources/**/*.swift'

s.osx.deployment_target = '10.11'
Expand Down
12 changes: 6 additions & 6 deletions BonMot.xcodeproj/project.pbxproj
Expand Up @@ -1388,7 +1388,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = 2KJHM26Y46;
INFOPLIST_FILE = "Example-iOS/Resources/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.rightpoint.Example-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -1405,7 +1405,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = 2KJHM26Y46;
INFOPLIST_FILE = "Example-iOS/Resources/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.rightpoint.Example-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -1544,7 +1544,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Sources/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.rightpoint.BonMot-iOS";
PRODUCT_NAME = BonMot;
Expand All @@ -1564,7 +1564,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Sources/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.rightpoint.BonMot-iOS";
PRODUCT_NAME = BonMot;
Expand Down Expand Up @@ -1615,7 +1615,7 @@
PRODUCT_NAME = BonMot;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.0;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
name = Debug;
};
Expand All @@ -1635,7 +1635,7 @@
PRODUCT_NAME = BonMot;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.0;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
name = Release;
};
Expand Down
21 changes: 6 additions & 15 deletions Sources/UIKit/UIKit+Helpers.swift
Expand Up @@ -34,24 +34,15 @@ extension UIFont {

extension UITraitCollection {

/// Obtain the `preferredContentSizeCategory` for the trait collection. This
/// is compatible with iOS 9.x and will use the
/// `UIApplication.shared.preferredContentSizeCategory` if the trait collection's
/// Obtain the `preferredContentSizeCategory` for the trait collection. This will use the
/// `UIScreen.main.traitCollection.preferredContentSizeCategory` if the trait collection's
/// `preferredContentSizeCategory` is `UIContentSizeCategory.unspecified`.
public var bon_preferredContentSizeCategory: BonMotContentSizeCategory {
if #available(iOS 10.0, tvOS 10.0, *) {
if preferredContentSizeCategory != .unspecified {
return preferredContentSizeCategory
}
}
// `UIApplication.shared` is not a valid object in unit tests. Fall back
// to a default value if the delegate is nil.
if UIApplication.shared.delegate != nil {
return UIApplication.shared.preferredContentSizeCategory
}
else {
return UIContentSizeCategory.large
if preferredContentSizeCategory != .unspecified {
return preferredContentSizeCategory
}

return UIScreen.main.traitCollection.preferredContentSizeCategory
}

}
Expand Down

0 comments on commit df9bb70

Please sign in to comment.