From 6acf5b4e7bcb664c8fa30450084df0e36a0bbcf9 Mon Sep 17 00:00:00 2001 From: gabmarfer Date: Wed, 26 Jun 2019 10:20:36 +0200 Subject: [PATCH 1/5] Update to Swift 5 --- Example/ViewController.swift | 2 + ImageViewer/AnimatableImageView.swift | 2 + ImageViewer/Info.plist | 4 +- SimpleImageViewer.xcodeproj/project.pbxproj | 63 ++++++++++++------- .../xcshareddata/IDEWorkspaceChecks.plist | 8 +++ .../xcschemes/SimpleImageViewer.xcscheme | 2 +- 6 files changed, 55 insertions(+), 26 deletions(-) create mode 100644 SimpleImageViewer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Example/ViewController.swift b/Example/ViewController.swift index ccdc911..4832a69 100644 --- a/Example/ViewController.swift +++ b/Example/ViewController.swift @@ -89,6 +89,8 @@ private extension UIView.ContentMode { return "bottomLeft" case .bottomRight: return "bottomRight" + @unknown default: + fatalError("Unknown contentMode") } } } diff --git a/ImageViewer/AnimatableImageView.swift b/ImageViewer/AnimatableImageView.swift index 26901ca..1fd7e25 100644 --- a/ImageViewer/AnimatableImageView.swift +++ b/ImageViewer/AnimatableImageView.swift @@ -74,6 +74,8 @@ private extension AnimatableImageView { case .bottomRight: imageView.bounds = Utilities.rect(forSize: image.size) imageView.center = Utilities.bottomRight(forSize: image.size, insideSize: bounds.size) + @unknown default: + fatalError("Unkown content mode") } } } diff --git a/ImageViewer/Info.plist b/ImageViewer/Info.plist index a246732..fd3e559 100644 --- a/ImageViewer/Info.plist +++ b/ImageViewer/Info.plist @@ -4,6 +4,8 @@ CFBundleDevelopmentRegion en + CFBundleDisplayName + SimpleImageViewer CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -17,7 +19,7 @@ CFBundleShortVersionString 1.1.1 CFBundleVersion - $(CURRENT_PROJECT_VERSION) + 1 NSPrincipalClass UILaunchStoryboardName diff --git a/SimpleImageViewer.xcodeproj/project.pbxproj b/SimpleImageViewer.xcodeproj/project.pbxproj index a918b3c..351b49c 100644 --- a/SimpleImageViewer.xcodeproj/project.pbxproj +++ b/SimpleImageViewer.xcodeproj/project.pbxproj @@ -281,30 +281,31 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0830; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = aFrogleap; TargetAttributes = { A02EE5D31EF1897D000EAB41 = { CreatedOnToolsVersion = 8.3.2; - DevelopmentTeam = WQEYNHG5C2; + DevelopmentTeam = GP4DF7F833; ProvisioningStyle = Automatic; }; A07E76D21ECC94A400B77D46 = { CreatedOnToolsVersion = 8.3.2; - DevelopmentTeam = 44MAY72KU6; + DevelopmentTeam = GP4DF7F833; LastSwiftMigration = 0900; - ProvisioningStyle = Manual; + ProvisioningStyle = Automatic; }; A0BF70A61EDC5B1400109F6E = { CreatedOnToolsVersion = 8.3.2; + DevelopmentTeam = GP4DF7F833; LastSwiftMigration = 1000; - ProvisioningStyle = Manual; + ProvisioningStyle = Automatic; }; }; }; buildConfigurationList = A07E76CE1ECC94A400B77D46 /* Build configuration list for PBXProject "SimpleImageViewer" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -412,24 +413,24 @@ A02EE5DD1EF1897D000EAB41 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - DEVELOPMENT_TEAM = WQEYNHG5C2; + DEVELOPMENT_TEAM = GP4DF7F833; INFOPLIST_FILE = SimpleImageViewerTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.afrogleap.SimpleImageViewerTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; A02EE5DE1EF1897D000EAB41 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - DEVELOPMENT_TEAM = WQEYNHG5C2; + DEVELOPMENT_TEAM = GP4DF7F833; INFOPLIST_FILE = SimpleImageViewerTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.afrogleap.SimpleImageViewerTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -447,6 +448,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -454,6 +456,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -464,6 +467,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = GP4DF7F833; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -486,6 +490,7 @@ SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -504,6 +509,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -511,6 +517,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -521,6 +528,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = GP4DF7F833; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -535,6 +543,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -545,17 +554,19 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEVELOPMENT_TEAM = 44MAY72KU6; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = GP4DF7F833; INFOPLIST_FILE = "$(SRCROOT)/ImageViewer/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 10.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.afrogleapbv.inhouse.swift.imageviewer; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = "d5b8f7cb-0120-427a-9ff1-14d28ee0046f"; - PROVISIONING_PROFILE_SPECIFIER = "aFrogleap Wildcard Development"; + PROVISIONING_PROFILE = ""; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -564,25 +575,28 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = ""; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = GP4DF7F833; INFOPLIST_FILE = "$(SRCROOT)/ImageViewer/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 10.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.afrogleapbv.inhouse.swift.imageviewer; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; A0BF70B11EDC5B1400109F6E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CODE_SIGN_IDENTITY = ""; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = GP4DF7F833; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -594,7 +608,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -603,10 +617,11 @@ A0BF70B21EDC5B1400109F6E /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CODE_SIGN_IDENTITY = ""; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = GP4DF7F833; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -618,7 +633,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; diff --git a/SimpleImageViewer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SimpleImageViewer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/SimpleImageViewer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/SimpleImageViewer.xcodeproj/xcshareddata/xcschemes/SimpleImageViewer.xcscheme b/SimpleImageViewer.xcodeproj/xcshareddata/xcschemes/SimpleImageViewer.xcscheme index bf75f27..b92f041 100644 --- a/SimpleImageViewer.xcodeproj/xcshareddata/xcschemes/SimpleImageViewer.xcscheme +++ b/SimpleImageViewer.xcodeproj/xcshareddata/xcschemes/SimpleImageViewer.xcscheme @@ -1,6 +1,6 @@ Date: Wed, 12 May 2021 11:41:50 +0200 Subject: [PATCH 2/5] Add swift tools version to Package manifest. --- Package.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Package.swift b/Package.swift index 2bbf2dd..c70bb13 100644 --- a/Package.swift +++ b/Package.swift @@ -1,3 +1,4 @@ +// swift-tools-version:5.0 import PackageDescription let package = Package( From 0eb3d8814aa5c6980c5922fb83f6dc0124c44ab6 Mon Sep 17 00:00:00 2001 From: gabmarfer Date: Wed, 12 May 2021 11:51:25 +0200 Subject: [PATCH 3/5] Add products to Package manifest. --- Package.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index c70bb13..c4a288f 100644 --- a/Package.swift +++ b/Package.swift @@ -3,5 +3,12 @@ import PackageDescription let package = Package( name: "SimpleImageViewer", - dependencies : [] + products: [ + .library(name: "SimpleImageViewer", targets: ["SimpleImageViewer"]), + ], + dependencies : [ + ], + targets: [ + .target(name: "SimpleImageViewer", dependencies: []), + ] ) From 96cda943fa44a8283e11c6acaa740363fb836caa Mon Sep 17 00:00:00 2001 From: gabmarfer Date: Wed, 12 May 2021 12:12:06 +0200 Subject: [PATCH 4/5] Update path of Package.swift. --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index c4a288f..47acad7 100644 --- a/Package.swift +++ b/Package.swift @@ -9,6 +9,6 @@ let package = Package( dependencies : [ ], targets: [ - .target(name: "SimpleImageViewer", dependencies: []), + .target(name: "SimpleImageViewer", dependencies: [], path: "ImageViewer"), ] ) From 9d752339d4045315e95bc0784c6ae36cad8e34d8 Mon Sep 17 00:00:00 2001 From: gabmarfer Date: Fri, 13 Aug 2021 13:21:30 +0200 Subject: [PATCH 5/5] Fixed crash when opening XIB. --- ImageViewer/ImageViewerController.swift | 8 +++++++- ImageViewer/Resources/ImageViewerController.xib | 17 ++++++----------- Package.swift | 12 +++++++++--- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/ImageViewer/ImageViewerController.swift b/ImageViewer/ImageViewerController.swift index 9634125..f07afe1 100644 --- a/ImageViewer/ImageViewerController.swift +++ b/ImageViewer/ImageViewerController.swift @@ -5,6 +5,12 @@ public final class ImageViewerController: UIViewController { @IBOutlet fileprivate var scrollView: UIScrollView! @IBOutlet fileprivate var imageView: UIImageView! @IBOutlet fileprivate var activityIndicator: UIActivityIndicatorView! + @IBOutlet fileprivate var closeButton: UIButton! { + didSet { + let closeImage = UIImage(named: "closeButton", in: Bundle.module, compatibleWith: nil) + closeButton.setImage(closeImage, for: .normal) + } + } fileprivate var transitionHandler: ImageViewerTransitioningHandler? fileprivate let configuration: ImageViewerConfiguration? @@ -15,7 +21,7 @@ public final class ImageViewerController: UIViewController { public init(configuration: ImageViewerConfiguration?) { self.configuration = configuration - super.init(nibName: String(describing: type(of: self)), bundle: Bundle(for: type(of: self))) + super.init(nibName: "ImageViewerController", bundle: .module) modalPresentationStyle = .overFullScreen modalTransitionStyle = .crossDissolve diff --git a/ImageViewer/Resources/ImageViewerController.xib b/ImageViewer/Resources/ImageViewerController.xib index 07595fc..f7cf298 100644 --- a/ImageViewer/Resources/ImageViewerController.xib +++ b/ImageViewer/Resources/ImageViewerController.xib @@ -1,18 +1,16 @@ - - - - + + - - + + @@ -45,12 +43,12 @@