Skip to content

Commit 1eaef69

Browse files
committed
Merge branch 'swift-4.2'
# Conflicts: # ImageSlideshow.podspec
2 parents f19fe97 + b3ff211 commit 1eaef69

File tree

10 files changed

+89
-53
lines changed

10 files changed

+89
-53
lines changed

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0
1+
4.2

Example/ImageSlideshow.xcodeproj/project.pbxproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
D0E8A9F51D97EB94007EC517 /* UIImage+AspectFit.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E8A9EE1D97EB94007EC517 /* UIImage+AspectFit.swift */; };
2828
D0E8A9F61D97EB94007EC517 /* UIImageView+Tools.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E8A9EF1D97EB94007EC517 /* UIImageView+Tools.swift */; };
2929
D0E8A9F71D97EB94007EC517 /* ZoomAnimatedTransitioning.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E8A9F01D97EB94007EC517 /* ZoomAnimatedTransitioning.swift */; };
30+
F539204C210F03610057EFB3 /* SwiftSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = F539204B210F03600057EFB3 /* SwiftSupport.swift */; };
3031
F802998F20CE9EA7009D64DD /* PageIndicatorPosition.swift in Sources */ = {isa = PBXBuildFile; fileRef = F802998E20CE9EA7009D64DD /* PageIndicatorPosition.swift */; };
3132
F802999020CE9EA7009D64DD /* PageIndicatorPosition.swift in Sources */ = {isa = PBXBuildFile; fileRef = F802998E20CE9EA7009D64DD /* PageIndicatorPosition.swift */; };
3233
F802999120CE9EA7009D64DD /* PageIndicatorPosition.swift in Sources */ = {isa = PBXBuildFile; fileRef = F802998E20CE9EA7009D64DD /* PageIndicatorPosition.swift */; };
@@ -73,6 +74,7 @@
7374
D0E8A9EE1D97EB94007EC517 /* UIImage+AspectFit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "UIImage+AspectFit.swift"; path = "../../ImageSlideshow/Classes/Core/UIImage+AspectFit.swift"; sourceTree = "<group>"; };
7475
D0E8A9EF1D97EB94007EC517 /* UIImageView+Tools.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "UIImageView+Tools.swift"; path = "../../ImageSlideshow/Classes/Core/UIImageView+Tools.swift"; sourceTree = "<group>"; };
7576
D0E8A9F01D97EB94007EC517 /* ZoomAnimatedTransitioning.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ZoomAnimatedTransitioning.swift; path = ../../ImageSlideshow/Classes/Core/ZoomAnimatedTransitioning.swift; sourceTree = "<group>"; };
77+
F539204B210F03600057EFB3 /* SwiftSupport.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SwiftSupport.swift; path = ../../ImageSlideshow/Classes/Core/SwiftSupport.swift; sourceTree = "<group>"; };
7678
F802998E20CE9EA7009D64DD /* PageIndicatorPosition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PageIndicatorPosition.swift; path = ../../ImageSlideshow/Classes/Core/PageIndicatorPosition.swift; sourceTree = "<group>"; };
7779
FD45C56C18E7B8EC08371B86 /* Pods-ImageSlideshow_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ImageSlideshow_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ImageSlideshow_Example/Pods-ImageSlideshow_Example.debug.xcconfig"; sourceTree = "<group>"; };
7880
/* End PBXFileReference section */
@@ -205,6 +207,7 @@
205207
D0E8A9E31D97EB6D007EC517 /* ImageSlideshow_framework */ = {
206208
isa = PBXGroup;
207209
children = (
210+
F539204B210F03600057EFB3 /* SwiftSupport.swift */,
208211
D0E8A9EA1D97EB94007EC517 /* FullScreenSlideshowViewController.swift */,
209212
D0B974AF202738F6006217CF /* PageIndicator.swift */,
210213
F802998E20CE9EA7009D64DD /* PageIndicatorPosition.swift */,
@@ -450,6 +453,7 @@
450453
F802999120CE9EA7009D64DD /* PageIndicatorPosition.swift in Sources */,
451454
D0E8A9F51D97EB94007EC517 /* UIImage+AspectFit.swift in Sources */,
452455
D0E8A9F11D97EB94007EC517 /* FullScreenSlideshowViewController.swift in Sources */,
456+
F539204C210F03610057EFB3 /* SwiftSupport.swift in Sources */,
453457
D0B974B0202738F6006217CF /* PageIndicator.swift in Sources */,
454458
D0E8A9F31D97EB94007EC517 /* ImageSlideshowItem.swift in Sources */,
455459
);
@@ -537,7 +541,7 @@
537541
ONLY_ACTIVE_ARCH = YES;
538542
SDKROOT = iphoneos;
539543
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
540-
SWIFT_VERSION = 4.0;
544+
SWIFT_VERSION = 4.2;
541545
};
542546
name = Debug;
543547
};
@@ -585,7 +589,7 @@
585589
MTL_ENABLE_DEBUG_INFO = NO;
586590
SDKROOT = iphoneos;
587591
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
588-
SWIFT_VERSION = 4.0;
592+
SWIFT_VERSION = 4.2;
589593
VALIDATE_PRODUCT = YES;
590594
};
591595
name = Release;
@@ -602,7 +606,6 @@
602606
MODULE_NAME = ExampleApp;
603607
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
604608
PRODUCT_NAME = "$(TARGET_NAME)";
605-
SWIFT_VERSION = 4.0;
606609
};
607610
name = Debug;
608611
};
@@ -618,7 +621,6 @@
618621
MODULE_NAME = ExampleApp;
619622
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
620623
PRODUCT_NAME = "$(TARGET_NAME)";
621-
SWIFT_VERSION = 4.0;
622624
};
623625
name = Release;
624626
};
@@ -678,7 +680,6 @@
678680
SKIP_INSTALL = YES;
679681
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
680682
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
681-
SWIFT_VERSION = 4.0;
682683
TARGETED_DEVICE_FAMILY = "1,2";
683684
VERSIONING_SYSTEM = "apple-generic";
684685
VERSION_INFO_PREFIX = "";
@@ -706,7 +707,6 @@
706707
PRODUCT_BUNDLE_IDENTIFIER = "io.zvo.ImageSlideshow-framework";
707708
PRODUCT_NAME = ImageSlideshow;
708709
SKIP_INSTALL = YES;
709-
SWIFT_VERSION = 4.0;
710710
TARGETED_DEVICE_FAMILY = "1,2";
711711
VERSIONING_SYSTEM = "apple-generic";
712712
VERSION_INFO_PREFIX = "";

Example/ImageSlideshow/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ViewController: UIViewController {
2828

2929
slideshow.slideshowInterval = 5.0
3030
slideshow.pageIndicatorPosition = .init(horizontal: .center, vertical: .under)
31-
slideshow.contentScaleMode = UIViewContentMode.scaleAspectFill
31+
slideshow.contentScaleMode = UIView.ContentMode.scaleAspectFill
3232

3333
let pageControl = UIPageControl()
3434
pageControl.currentPageIndicatorTintColor = UIColor.lightGray

Example/Podfile.lock

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
PODS:
2-
- AFNetworking (3.1.0):
3-
- AFNetworking/NSURLSession (= 3.1.0)
4-
- AFNetworking/Reachability (= 3.1.0)
5-
- AFNetworking/Security (= 3.1.0)
6-
- AFNetworking/Serialization (= 3.1.0)
7-
- AFNetworking/UIKit (= 3.1.0)
8-
- AFNetworking/NSURLSession (3.1.0):
2+
- AFNetworking (3.2.1):
3+
- AFNetworking/NSURLSession (= 3.2.1)
4+
- AFNetworking/Reachability (= 3.2.1)
5+
- AFNetworking/Security (= 3.2.1)
6+
- AFNetworking/Serialization (= 3.2.1)
7+
- AFNetworking/UIKit (= 3.2.1)
8+
- AFNetworking/NSURLSession (3.2.1):
99
- AFNetworking/Reachability
1010
- AFNetworking/Security
1111
- AFNetworking/Serialization
12-
- AFNetworking/Reachability (3.1.0)
13-
- AFNetworking/Security (3.1.0)
14-
- AFNetworking/Serialization (3.1.0)
15-
- AFNetworking/UIKit (3.1.0):
12+
- AFNetworking/Reachability (3.2.1)
13+
- AFNetworking/Security (3.2.1)
14+
- AFNetworking/Serialization (3.2.1)
15+
- AFNetworking/UIKit (3.2.1):
1616
- AFNetworking/NSURLSession
17-
- Alamofire (4.5.1)
18-
- AlamofireImage (3.3.0):
19-
- Alamofire (~> 4.5)
20-
- ImageSlideshow (1.6):
21-
- ImageSlideshow/Core (= 1.6)
22-
- ImageSlideshow/AFURL (1.6):
17+
- Alamofire (4.7.3)
18+
- AlamofireImage (3.4.1):
19+
- Alamofire (~> 4.7)
20+
- ImageSlideshow (1.6.0):
21+
- ImageSlideshow/Core (= 1.6.0)
22+
- ImageSlideshow/AFURL (1.6.0):
2323
- AFNetworking (~> 3.0)
2424
- ImageSlideshow/Core
25-
- ImageSlideshow/Alamofire (1.6):
25+
- ImageSlideshow/Alamofire (1.6.0):
2626
- AlamofireImage (~> 3.0)
2727
- ImageSlideshow/Core
28-
- ImageSlideshow/Core (1.6)
29-
- ImageSlideshow/Kingfisher (1.6):
28+
- ImageSlideshow/Core (1.6.0)
29+
- ImageSlideshow/Kingfisher (1.6.0):
3030
- ImageSlideshow/Core
3131
- Kingfisher (> 3.0)
32-
- ImageSlideshow/SDWebImage (1.6):
32+
- ImageSlideshow/SDWebImage (1.6.0):
3333
- ImageSlideshow/Core
3434
- SDWebImage (< 5.0, >= 3.7)
35-
- Kingfisher (4.0.1)
36-
- SDWebImage (3.8.2):
37-
- SDWebImage/Core (= 3.8.2)
38-
- SDWebImage/Core (3.8.2)
35+
- Kingfisher (4.10.0)
36+
- SDWebImage (4.4.2):
37+
- SDWebImage/Core (= 4.4.2)
38+
- SDWebImage/Core (4.4.2)
3939

4040
DEPENDENCIES:
4141
- ImageSlideshow (from `../`)
@@ -57,12 +57,12 @@ EXTERNAL SOURCES:
5757
:path: "../"
5858

5959
SPEC CHECKSUMS:
60-
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
61-
Alamofire: 2d95912bf4c34f164fdfc335872e8c312acaea4a
62-
AlamofireImage: 2e784dc5d00f04903a52c1d169181469c805c3df
63-
ImageSlideshow: f06168438862e8b2c901b2066f3abb5d20f7dd50
64-
Kingfisher: b771785e9461ed4b8686d40e7145f9e58100cb24
65-
SDWebImage: 098e97e6176540799c27e804c96653ee0833d13c
60+
AFNetworking: b6f891fdfaed196b46c7a83cf209e09697b94057
61+
Alamofire: c7287b6e5d7da964a70935e5db17046b7fde6568
62+
AlamofireImage: 78d67ccbb763d87ba44b21583d2153500a195630
63+
ImageSlideshow: 17a44fe50c43779149f83c3e369a3d9701f06d65
64+
Kingfisher: 43c4b802d8b5256cf1f4379e9cd10b329be6d3e2
65+
SDWebImage: 624d6e296c69b244bcede364c72ae0430ac14681
6666

6767
PODFILE CHECKSUM: 9f5f0235fb1728554054ee3ff7128ff5d4729418
6868

ImageSlideshow.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = "ImageSlideshow"
11-
s.version = "1.6.1"
11+
s.version = "1.7.0"
1212
s.summary = "Image slideshow written in Swift with circular scrolling, timer and full screen viewer"
1313

1414
# This description is used to generate tags and improve search results.
@@ -27,7 +27,7 @@ Image slideshow is a Swift library providing customizable image slideshow with c
2727
s.source = { :git => "https://github.com/zvonicek/ImageSlideshow.git", :tag => s.version.to_s }
2828
s.social_media_url = 'https://twitter.com/zvonicek'
2929

30-
s.swift_version = '4.0'
30+
s.swift_version = '4.2'
3131
s.platform = :ios, '8.0'
3232
s.requires_arc = true
3333

ImageSlideshow/Classes/Core/ActivityIndicator.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,27 @@ extension UIActivityIndicatorView: ActivityIndicatorView {
4343
@objcMembers
4444
open class DefaultActivityIndicator: ActivityIndicatorFactory {
4545
/// activity indicator style
46-
open var style: UIActivityIndicatorViewStyle
46+
open var style: UIActivityIndicatorView.Style
47+
4748
/// activity indicator color
4849
open var color: UIColor?
4950

5051
/// Create a new ActivityIndicator for UIActivityIndicatorView
5152
///
5253
/// - style: activity indicator style
5354
/// - color: activity indicator color
54-
public init(style: UIActivityIndicatorViewStyle = .gray, color: UIColor? = nil) {
55+
public init(style: UIActivityIndicatorView.Style = .gray, color: UIColor? = nil) {
5556
self.style = style
5657
self.color = color
5758
}
5859

5960
/// create ActivityIndicatorView instance
6061
open func create() -> ActivityIndicatorView {
62+
#if swift(>=4.2)
63+
let activityIndicator = UIActivityIndicatorView(style: style)
64+
#else
6165
let activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: style)
66+
#endif
6267
activityIndicator.color = color
6368
activityIndicator.hidesWhenStopped = true
6469

ImageSlideshow/Classes/Core/ImageSlideshow.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public enum ImagePreload {
3535
open class ImageSlideshow: UIView {
3636

3737
/// Scroll View to wrap the slideshow
38-
open let scrollView = UIScrollView()
38+
public let scrollView = UIScrollView()
3939

4040
/// Page Control shown in the slideshow
4141
@available(*, deprecated, message: "Use pageIndicator.view instead")
@@ -170,7 +170,7 @@ open class ImageSlideshow: UIView {
170170
open var preload = ImagePreload.all
171171

172172
/// Content mode of each image in the slideshow
173-
open var contentScaleMode: UIViewContentMode = UIViewContentMode.scaleAspectFit {
173+
open var contentScaleMode: UIView.ContentMode = UIView.ContentMode.scaleAspectFit {
174174
didSet {
175175
for view in slideshowItems {
176176
view.imageView.contentMode = contentScaleMode

ImageSlideshow/Classes/Core/ImageSlideshowItem.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ import UIKit
1212
open class ImageSlideshowItem: UIScrollView, UIScrollViewDelegate {
1313

1414
/// Image view to hold the image
15-
open let imageView = UIImageView()
15+
public let imageView = UIImageView()
1616

1717
/// Activity indicator shown during image loading, when nil there won't be shown any
18-
open let activityIndicator: ActivityIndicatorView?
18+
public let activityIndicator: ActivityIndicatorView?
1919

2020
/// Input Source for the item
21-
open let image: InputSource
21+
public let image: InputSource
2222

2323
/// Guesture recognizer to detect double tap to zoom
2424
open var gestureRecognizer: UITapGestureRecognizer?
2525

2626
/// Holds if the zoom feature is enabled
27-
open let zoomEnabled: Bool
27+
public let zoomEnabled: Bool
2828

2929
/// If set to true image is initially zoomed in
3030
open var zoomInInitially = false
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// SwiftSupport.swift
3+
// ImageSlideshow
4+
//
5+
// Created by Pierluigi Cifani on 30/07/2018.
6+
//
7+
8+
import UIKit
9+
10+
#if swift(>=4.2)
11+
typealias UIViewContentMode = UIView.ContentMode
12+
typealias UIActivityIndicatorViewStyle = UIActivityIndicatorView.Style
13+
typealias UIControlState = UIControl.State
14+
typealias UIViewAnimationOptions = UIView.AnimationOptions
15+
typealias UIControlEvents = UIControl.Event
16+
typealias UIViewAutoresizing = UIView.AutoresizingMask
17+
#else
18+
#endif

ImageSlideshow/Classes/Core/ZoomAnimatedTransitioning.swift

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ open class ZoomAnimatedTransitioningDelegate: NSObject, UIViewControllerTransiti
6666
return
6767
}
6868

69-
let percent = min(max(fabs(gesture.translation(in: gesture.view!).y) / 200.0, 0.0), 1.0)
69+
let percent = min(max(abs(gesture.translation(in: gesture.view!).y) / 200.0, 0.0), 1.0)
7070

7171
if gesture.state == .began {
7272
interactionController = UIPercentDrivenInteractiveTransition()
@@ -76,7 +76,7 @@ open class ZoomAnimatedTransitioningDelegate: NSObject, UIViewControllerTransiti
7676
} else if gesture.state == .ended || gesture.state == .cancelled || gesture.state == .failed {
7777
let velocity = gesture.velocity(in: referenceSlideshowView)
7878

79-
if fabs(velocity.y) > 500 {
79+
if abs(velocity.y) > 500 {
8080
if let pageSelected = referenceSlideshowController.pageSelected {
8181
pageSelected(referenceSlideshowController.slideshow.currentPage)
8282
}
@@ -141,7 +141,7 @@ extension ZoomAnimatedTransitioningDelegate: UIGestureRecognizerDelegate {
141141

142142
if let view = gestureRecognizer.view {
143143
let velocity = gestureRecognizer.velocity(in: view)
144-
return fabs(velocity.x) < fabs(velocity.y)
144+
return abs(velocity.x) < abs(velocity.y)
145145
}
146146

147147
return true
@@ -192,8 +192,14 @@ class ZoomInAnimator: ZoomAnimator, UIViewControllerAnimatedTransitioning {
192192
let transitionBackgroundView = UIView(frame: containerView.frame)
193193
transitionBackgroundView.backgroundColor = toViewController.backgroundColor
194194
containerView.addSubview(transitionBackgroundView)
195+
196+
#if swift(>=4.2)
197+
containerView.sendSubviewToBack(transitionBackgroundView)
198+
#else
195199
containerView.sendSubview(toBack: transitionBackgroundView)
200+
#endif
196201

202+
197203
let finalFrame = toViewController.view.frame
198204

199205
var transitionView: UIImageView?
@@ -270,8 +276,11 @@ class ZoomOutAnimator: ZoomAnimator, UIViewControllerAnimatedTransitioning {
270276
toViewController.view.frame = transitionContext.finalFrame(for: toViewController)
271277
toViewController.view.alpha = 0
272278
containerView.addSubview(toViewController.view)
279+
#if swift(>=4.2)
280+
containerView.sendSubviewToBack(toViewController.view)
281+
#else
273282
containerView.sendSubview(toBack: toViewController.view)
274-
283+
#endif
275284
var transitionViewInitialFrame: CGRect
276285
if let currentSlideshowItem = fromViewController.slideshow.currentSlideshowItem {
277286
if let image = currentSlideshowItem.imageView.image {
@@ -307,7 +316,11 @@ class ZoomOutAnimator: ZoomAnimator, UIViewControllerAnimatedTransitioning {
307316
let transitionBackgroundView = UIView(frame: containerView.frame)
308317
transitionBackgroundView.backgroundColor = fromViewController.backgroundColor
309318
containerView.addSubview(transitionBackgroundView)
319+
#if swift(>=4.2)
320+
containerView.sendSubviewToBack(transitionBackgroundView)
321+
#else
310322
containerView.sendSubview(toBack: transitionBackgroundView)
323+
#endif
311324

312325
let transitionView: UIImageView = UIImageView(image: fromViewController.slideshow.currentSlideshowItem?.imageView.image)
313326
transitionView.contentMode = UIViewContentMode.scaleAspectFill

0 commit comments

Comments
 (0)