Migrate swift language version from 4.0 to 4.2.
This commit is contained in:
parent
f280708f52
commit
985890d382
|
|
@ -459,7 +459,7 @@
|
|||
PRODUCT_BUNDLE_IDENTIFIER = com.wenchaod.FSPagerViewExample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 4.2;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
|
@ -473,7 +473,7 @@
|
|||
PRODUCT_BUNDLE_IDENTIFIER = com.wenchaod.FSPagerViewExample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 4.2;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||
var window: UIWindow?
|
||||
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
// Override point for customization after application launch.
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@
|
|||
F9580B751E5D9F0600C5B267 = {
|
||||
CreatedOnToolsVersion = 8.2.1;
|
||||
DevelopmentTeam = HZF422TY46;
|
||||
LastSwiftMigration = 1000;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
};
|
||||
|
|
@ -299,6 +300,7 @@
|
|||
F9580B7F1E5D9F0600C5B267 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = HZF422TY46;
|
||||
|
|
@ -312,13 +314,15 @@
|
|||
PRODUCT_BUNDLE_IDENTIFIER = com.wenchaod.FSPagerView;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 4.2;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
F9580B801E5D9F0600C5B267 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = HZF422TY46;
|
||||
|
|
@ -332,7 +336,7 @@
|
|||
PRODUCT_BUNDLE_IDENTIFIER = com.wenchaod.FSPagerView;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 4.2;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -530,7 +530,7 @@
|
|||
PRODUCT_BUNDLE_IDENTIFIER = "com.wenchaod.FSPagerView-Objc";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 4.2;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
|
@ -544,7 +544,7 @@
|
|||
PRODUCT_BUNDLE_IDENTIFIER = "com.wenchaod.FSPagerView-Objc";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 4.2;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ open class FSPageControl: UIControl {
|
|||
}
|
||||
|
||||
/// The horizontal alignment of content within the control’s bounds. Default is center.
|
||||
open override var contentHorizontalAlignment: UIControlContentHorizontalAlignment {
|
||||
open override var contentHorizontalAlignment: UIControl.ContentHorizontalAlignment {
|
||||
didSet {
|
||||
self.setNeedsLayout()
|
||||
}
|
||||
|
|
@ -66,12 +66,12 @@ open class FSPageControl: UIControl {
|
|||
}
|
||||
}
|
||||
|
||||
internal var strokeColors: [UIControlState: UIColor] = [:]
|
||||
internal var fillColors: [UIControlState: UIColor] = [:]
|
||||
internal var paths: [UIControlState: UIBezierPath] = [:]
|
||||
internal var images: [UIControlState: UIImage] = [:]
|
||||
internal var alphas: [UIControlState: CGFloat] = [:]
|
||||
internal var transforms: [UIControlState: CGAffineTransform] = [:]
|
||||
internal var strokeColors: [UIControl.State: UIColor] = [:]
|
||||
internal var fillColors: [UIControl.State: UIColor] = [:]
|
||||
internal var paths: [UIControl.State: UIBezierPath] = [:]
|
||||
internal var images: [UIControl.State: UIImage] = [:]
|
||||
internal var alphas: [UIControl.State: CGFloat] = [:]
|
||||
internal var transforms: [UIControl.State: CGAffineTransform] = [:]
|
||||
|
||||
fileprivate weak var contentView: UIView!
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ open class FSPageControl: UIControl {
|
|||
}
|
||||
}()
|
||||
for (index,value) in self.indicatorLayers.enumerated() {
|
||||
let state: UIControlState = (index == self.currentPage) ? .selected : .normal
|
||||
let state: UIControl.State = (index == self.currentPage) ? .selected : .normal
|
||||
let image = self.images[state]
|
||||
let size = image?.size ?? CGSize(width: diameter, height: diameter)
|
||||
let origin = CGPoint(x: x - (size.width-diameter)*0.5, y: self.contentView.bounds.midY-size.height*0.5)
|
||||
|
|
@ -136,7 +136,7 @@ open class FSPageControl: UIControl {
|
|||
/// - strokeColor: The stroke color to use for the specified state.
|
||||
/// - state: The state that uses the specified stroke color.
|
||||
@objc(setStrokeColor:forState:)
|
||||
open func setStrokeColor(_ strokeColor: UIColor?, for state: UIControlState) {
|
||||
open func setStrokeColor(_ strokeColor: UIColor?, for state: UIControl.State) {
|
||||
guard self.strokeColors[state] != strokeColor else {
|
||||
return
|
||||
}
|
||||
|
|
@ -150,7 +150,7 @@ open class FSPageControl: UIControl {
|
|||
/// - fillColor: The fill color to use for the specified state.
|
||||
/// - state: The state that uses the specified fill color.
|
||||
@objc(setFillColor:forState:)
|
||||
open func setFillColor(_ fillColor: UIColor?, for state: UIControlState) {
|
||||
open func setFillColor(_ fillColor: UIColor?, for state: UIControl.State) {
|
||||
guard self.fillColors[state] != fillColor else {
|
||||
return
|
||||
}
|
||||
|
|
@ -164,7 +164,7 @@ open class FSPageControl: UIControl {
|
|||
/// - image: The image to use for the specified state.
|
||||
/// - state: The state that uses the specified image.
|
||||
@objc(setImage:forState:)
|
||||
open func setImage(_ image: UIImage?, for state: UIControlState) {
|
||||
open func setImage(_ image: UIImage?, for state: UIControl.State) {
|
||||
guard self.images[state] != image else {
|
||||
return
|
||||
}
|
||||
|
|
@ -179,7 +179,7 @@ open class FSPageControl: UIControl {
|
|||
/// - Parameters:
|
||||
/// - alpha: The alpha value to use for the specified state.
|
||||
/// - state: The state that uses the specified alpha.
|
||||
open func setAlpha(_ alpha: CGFloat, for state: UIControlState) {
|
||||
open func setAlpha(_ alpha: CGFloat, for state: UIControl.State) {
|
||||
guard self.alphas[state] != alpha else {
|
||||
return
|
||||
}
|
||||
|
|
@ -193,7 +193,7 @@ open class FSPageControl: UIControl {
|
|||
/// - path: The path to use for the specified state.
|
||||
/// - state: The state that uses the specified path.
|
||||
@objc(setPath:forState:)
|
||||
open func setPath(_ path: UIBezierPath?, for state: UIControlState) {
|
||||
open func setPath(_ path: UIBezierPath?, for state: UIControl.State) {
|
||||
guard self.paths[state] != path else {
|
||||
return
|
||||
}
|
||||
|
|
@ -241,7 +241,7 @@ open class FSPageControl: UIControl {
|
|||
|
||||
fileprivate func updateIndicatorAttributes(for layer: CAShapeLayer) {
|
||||
let index = self.indicatorLayers.index(of: layer)
|
||||
let state: UIControlState = index == self.currentPage ? .selected : .normal
|
||||
let state: UIControl.State = index == self.currentPage ? .selected : .normal
|
||||
if let image = self.images[state] {
|
||||
layer.strokeColor = nil
|
||||
layer.fillColor = nil
|
||||
|
|
@ -300,7 +300,7 @@ open class FSPageControl: UIControl {
|
|||
|
||||
}
|
||||
|
||||
extension UIControlState: Hashable {
|
||||
extension UIControl.State: Hashable {
|
||||
public var hashValue: Int {
|
||||
return Int((6777*self.rawValue+3777)%UInt(UInt16.max))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class FSPagerViewLayout: UICollectionViewLayout {
|
|||
internal var leadingSpacing: CGFloat = 0
|
||||
internal var itemSpacing: CGFloat = 0
|
||||
internal var needsReprepare = true
|
||||
internal var scrollDirection: FSPagerViewScrollDirection = .horizontal
|
||||
internal var scrollDirection: FSPagerView.ScrollDirection = .horizontal
|
||||
|
||||
open override class var layoutAttributesClass: AnyClass {
|
||||
get {
|
||||
|
|
@ -45,7 +45,7 @@ class FSPagerViewLayout: UICollectionViewLayout {
|
|||
|
||||
deinit {
|
||||
#if !os(tvOS)
|
||||
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIDeviceOrientationDidChange, object: nil)
|
||||
NotificationCenter.default.removeObserver(self, name: UIDevice.orientationDidChangeNotification, object: nil)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ class FSPagerViewLayout: UICollectionViewLayout {
|
|||
var origin = startPosition
|
||||
let maxPosition = self.scrollDirection == .horizontal ? min(rect.maxX,self.contentSize.width-self.actualItemSize.width-self.leadingSpacing) : min(rect.maxY,self.contentSize.height-self.actualItemSize.height-self.leadingSpacing)
|
||||
// https://stackoverflow.com/a/10335601/2398107
|
||||
while origin-maxPosition <= max(CGFloat(100.0) * .ulpOfOne * fabs(origin+maxPosition), .leastNonzeroMagnitude) {
|
||||
while origin-maxPosition <= max(CGFloat(100.0) * .ulpOfOne * abs(origin+maxPosition), .leastNonzeroMagnitude) {
|
||||
let indexPath = IndexPath(item: itemIndex%self.numberOfItems, section: itemIndex/self.numberOfItems)
|
||||
let attributes = self.layoutAttributesForItem(at: indexPath) as! FSPagerViewLayoutAttributes
|
||||
self.applyTransform(to: attributes, with: self.pagerView?.transformer)
|
||||
|
|
@ -260,7 +260,7 @@ class FSPagerViewLayout: UICollectionViewLayout {
|
|||
|
||||
fileprivate func commonInit() {
|
||||
#if !os(tvOS)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(didReceiveNotification(notification:)), name: NSNotification.Name.UIDeviceOrientationDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(didReceiveNotification(notification:)), name: UIDevice.orientationDidChangeNotification, object: nil)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class FSPagerViewCollectionView: UICollectionView {
|
|||
|
||||
fileprivate func commonInit() {
|
||||
self.contentInset = .zero
|
||||
self.decelerationRate = UIScrollViewDecelerationRateFast
|
||||
self.decelerationRate = UIScrollView.DecelerationRate.fast
|
||||
self.showsVerticalScrollIndicator = false
|
||||
self.showsHorizontalScrollIndicator = false
|
||||
if #available(iOS 10.0, *) {
|
||||
|
|
|
|||
|
|
@ -498,7 +498,7 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
|
|||
@objc(selectItemAtIndex:animated:)
|
||||
open func selectItem(at index: Int, animated: Bool) {
|
||||
let indexPath = self.nearbyIndexPath(for: index)
|
||||
let scrollPosition: UICollectionViewScrollPosition = self.scrollDirection == .horizontal ? .centeredHorizontally : .centeredVertically
|
||||
let scrollPosition: UICollectionView.ScrollPosition = self.scrollDirection == .horizontal ? .centeredHorizontally : .centeredVertically
|
||||
self.collectionView.selectItem(at: indexPath, animated: animated, scrollPosition: scrollPosition)
|
||||
}
|
||||
|
||||
|
|
@ -575,7 +575,7 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
|
|||
return
|
||||
}
|
||||
self.timer = Timer.scheduledTimer(timeInterval: TimeInterval(self.automaticSlidingInterval), target: self, selector: #selector(self.flipNext(sender:)), userInfo: nil, repeats: true)
|
||||
RunLoop.current.add(self.timer!, forMode: .commonModes)
|
||||
RunLoop.current.add(self.timer!, forMode: .common)
|
||||
}
|
||||
|
||||
@objc
|
||||
|
|
|
|||
Loading…
Reference in New Issue