8 Commits

Author SHA1 Message Date
Pete Smith 054ae02207 Merge pull request #46 from superpeteblaze/psmith/Swift4.2
Psmith/swift4.2
2018-09-29 15:57:00 +01:00
Pete Smith 2baf27aa36 Update travis build 2018-09-29 15:51:53 +01:00
Pete Smith e3cd3f646e Remove empty test target 2018-09-29 15:38:54 +01:00
Pete Smith 1ee942924e Convert to Swift 4.2, bump minimum deployment version to iOS 10 2018-09-29 15:37:12 +01:00
Pete Smith 7bc09a4947 Bump version 2018-05-28 10:37:34 +04:00
Pete Smith e2e0a59efc Merge pull request #39 from pabsanmez/fixOnDeviceRotation
Fix ScalingCarousel on Device Rotation
2018-05-28 10:34:08 +04:00
pabsanmez cf744094b0 Added feature to example 2018-05-27 21:35:02 +02:00
pabsanmez 8f7b1d1b1d Fix Device Rotated and autolayout mainView in code version 2018-05-27 21:20:35 +02:00
15 changed files with 107 additions and 276 deletions
+1 -1
View File
@@ -1 +1 @@
4.0
4.2
+2 -2
View File
@@ -3,12 +3,12 @@
# * https://github.com/supermarin/xcpretty#usage
language: objective-c
osx_image: xcode9
osx_image: xcode10
# cache: cocoapods
# podfile: Example/Podfile
before_install:
- gem install cocoapods # Since Travis is not always on latest version
# - pod install --project-directory=Example
script:
- set -o pipefail && xcodebuild -workspace Example/ScalingCarousel.xcworkspace -scheme ScalingCarousel-Example -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=11.0,name=iPhone 7' ONLY_ACTIVE_ARCH=NO | xcpretty
- set -o pipefail && xcodebuild -workspace Example/ScalingCarousel.xcworkspace -scheme ScalingCarousel-Example -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=12.0,name=iPhone Xs' ONLY_ACTIVE_ARCH=NO | xcpretty
- pod lib lint
+7 -9
View File
@@ -304,7 +304,7 @@
LastUpgradeCheck = 0930;
TargetAttributes = {
E9582E7E712D7CD7A32DF86E8120CBC5 = {
LastSwiftMigration = 0930;
LastSwiftMigration = 1000;
};
};
};
@@ -383,7 +383,7 @@
GCC_PREFIX_HEADER = "Target Support Files/ScalingCarousel/ScalingCarousel-prefix.pch";
INFOPLIST_FILE = "Target Support Files/ScalingCarousel/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";
MODULEMAP_FILE = "Target Support Files/ScalingCarousel/ScalingCarousel.modulemap";
PRODUCT_NAME = ScalingCarousel;
@@ -391,8 +391,7 @@
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) ";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
@@ -481,7 +480,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/;
@@ -575,7 +574,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -668,7 +667,7 @@
GCC_PREFIX_HEADER = "Target Support Files/ScalingCarousel/ScalingCarousel-prefix.pch";
INFOPLIST_FILE = "Target Support Files/ScalingCarousel/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";
MODULEMAP_FILE = "Target Support Files/ScalingCarousel/ScalingCarousel.modulemap";
PRODUCT_NAME = ScalingCarousel;
@@ -676,8 +675,7 @@
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) ";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.2</string>
<string>2.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
@@ -8,27 +8,15 @@
/* Begin PBXBuildFile section */
371D5443D4C13439BA9B90F3 /* Pods_ScalingCarousel_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 458709EF51094BC6F4D04000 /* Pods_ScalingCarousel_Example.framework */; };
56B3452030AFA76E567C5BDE /* Pods_ScalingCarousel_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76B5BA65FCAD75DAB10B57A9 /* Pods_ScalingCarousel_Tests.framework */; };
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; };
607FACD81AFB9204008FA782 /* StoryboardViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* StoryboardViewController.swift */; };
607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; };
607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; };
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; };
607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; };
65678AFE206FEAF900A0ED42 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 65678AFD206FEAF900A0ED42 /* Default-568h@2x.png */; };
65E99FA11E1519D50026BEC4 /* CodeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E99FA01E1519D50026BEC4 /* CodeViewController.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
607FACE61AFB9204008FA782 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 607FACC81AFB9204008FA782 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 607FACCF1AFB9204008FA782;
remoteInfo = ScalingCarousel;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
2AC39C6CC3E82205FC41C768 /* Pods-ScalingCarousel_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ScalingCarousel_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ScalingCarousel_Tests/Pods-ScalingCarousel_Tests.release.xcconfig"; sourceTree = "<group>"; };
2CDA8F1B0A30ECE4574BBC6B /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
@@ -41,9 +29,6 @@
607FACDA1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
607FACE51AFB9204008FA782 /* ScalingCarousel_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ScalingCarousel_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = "<group>"; };
65678AFD206FEAF900A0ED42 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
659A02AC202F775500587C36 /* ScalingCarousel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScalingCarousel.h; sourceTree = "<group>"; };
659A02AD202F775500587C36 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -64,14 +49,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
607FACE21AFB9204008FA782 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
56B3452030AFA76E567C5BDE /* Pods_ScalingCarousel_Tests.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
@@ -90,7 +67,6 @@
65678AFD206FEAF900A0ED42 /* Default-568h@2x.png */,
607FACF51AFB993E008FA782 /* Podspec Metadata */,
607FACD21AFB9204008FA782 /* Example */,
607FACE81AFB9204008FA782 /* Tests */,
659A02AB202F775500587C36 /* ScalingCarousel */,
607FACD11AFB9204008FA782 /* Products */,
AB4C669AD33FFC8D61F2C71C /* Pods */,
@@ -102,7 +78,6 @@
isa = PBXGroup;
children = (
607FACD01AFB9204008FA782 /* ScalingCarousel_Example.app */,
607FACE51AFB9204008FA782 /* ScalingCarousel_Tests.xctest */,
);
name = Products;
sourceTree = "<group>";
@@ -128,23 +103,6 @@
name = "Supporting Files";
sourceTree = "<group>";
};
607FACE81AFB9204008FA782 /* Tests */ = {
isa = PBXGroup;
children = (
607FACEB1AFB9204008FA782 /* Tests.swift */,
607FACE91AFB9204008FA782 /* Supporting Files */,
);
path = Tests;
sourceTree = "<group>";
};
607FACE91AFB9204008FA782 /* Supporting Files */ = {
isa = PBXGroup;
children = (
607FACEA1AFB9204008FA782 /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
607FACF51AFB993E008FA782 /* Podspec Metadata */ = {
isa = PBXGroup;
children = (
@@ -232,27 +190,6 @@
productReference = 607FACD01AFB9204008FA782 /* ScalingCarousel_Example.app */;
productType = "com.apple.product-type.application";
};
607FACE41AFB9204008FA782 /* ScalingCarousel_Tests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "ScalingCarousel_Tests" */;
buildPhases = (
AA74BD7EB113F9466B0D7AC2 /* [CP] Check Pods Manifest.lock */,
607FACE11AFB9204008FA782 /* Sources */,
607FACE21AFB9204008FA782 /* Frameworks */,
607FACE31AFB9204008FA782 /* Resources */,
2EA17C40F55BF7F7F0EAFBD9 /* [CP] Embed Pods Frameworks */,
CB654E16ABAC105B309D80F5 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
dependencies = (
607FACE71AFB9204008FA782 /* PBXTargetDependency */,
);
name = ScalingCarousel_Tests;
productName = Tests;
productReference = 607FACE51AFB9204008FA782 /* ScalingCarousel_Tests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -266,13 +203,7 @@
607FACCF1AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
DevelopmentTeam = 49CJ89TL4W;
LastSwiftMigration = 0900;
};
607FACE41AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
DevelopmentTeam = 49CJ89TL4W;
LastSwiftMigration = 0900;
TestTargetID = 607FACCF1AFB9204008FA782;
LastSwiftMigration = 1000;
};
};
};
@@ -290,7 +221,6 @@
projectRoot = "";
targets = (
607FACCF1AFB9204008FA782 /* ScalingCarousel_Example */,
607FACE41AFB9204008FA782 /* ScalingCarousel_Tests */,
);
};
/* End PBXProject section */
@@ -307,31 +237,9 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
607FACE31AFB9204008FA782 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
2EA17C40F55BF7F7F0EAFBD9 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ScalingCarousel_Tests/Pods-ScalingCarousel_Tests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
2F81D719AB74666EA6BF3325 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -347,24 +255,6 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ScalingCarousel_Example/Pods-ScalingCarousel_Example-resources.sh\"\n";
showEnvVarsInLog = 0;
};
AA74BD7EB113F9466B0D7AC2 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-ScalingCarousel_Tests-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
BA663BC8D55C4A023C2ED9E6 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -401,21 +291,6 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ScalingCarousel_Example/Pods-ScalingCarousel_Example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
CB654E16ABAC105B309D80F5 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ScalingCarousel_Tests/Pods-ScalingCarousel_Tests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -429,24 +304,8 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
607FACE11AFB9204008FA782 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
607FACEC1AFB9204008FA782 /* Tests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
607FACE71AFB9204008FA782 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 607FACCF1AFB9204008FA782 /* ScalingCarousel_Example */;
targetProxy = 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
607FACD91AFB9204008FA782 /* Main.storyboard */ = {
isa = PBXVariantGroup;
@@ -514,7 +373,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -562,7 +421,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
@@ -578,13 +437,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 49CJ89TL4W;
INFOPLIST_FILE = ScalingCarousel/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
@@ -596,53 +454,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 49CJ89TL4W;
INFOPLIST_FILE = ScalingCarousel/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
};
name = Release;
};
607FACF31AFB9204008FA782 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = BA63361010B0F437C40DBABF /* Pods-ScalingCarousel_Tests.debug.xcconfig */;
buildSettings = {
DEVELOPMENT_TEAM = 49CJ89TL4W;
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
607FACF41AFB9204008FA782 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 2AC39C6CC3E82205FC41C768 /* Pods-ScalingCarousel_Tests.release.xcconfig */;
buildSettings = {
DEVELOPMENT_TEAM = 49CJ89TL4W;
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
@@ -667,15 +484,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "ScalingCarousel_Tests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
607FACF31AFB9204008FA782 /* Debug */,
607FACF41AFB9204008FA782 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 607FACC81AFB9204008FA782 /* Project object */;
+1 -1
View File
@@ -13,7 +13,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
return true
}
@@ -16,6 +16,13 @@ class CodeCell: ScalingCarouselCell {
mainView = UIView(frame: contentView.bounds)
contentView.addSubview(mainView)
mainView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
mainView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
mainView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
mainView.topAnchor.constraint(equalTo: contentView.topAnchor),
mainView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor)
])
}
required init?(coder aDecoder: NSCoder) {
@@ -40,6 +47,13 @@ class CodeViewController: UIViewController {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
if scalingCarousel != nil {
scalingCarousel.deviceRotated()
}
}
// MARK: - Configuration
@@ -76,7 +90,11 @@ extension CodeViewController: UICollectionViewDataSource {
if let scalingCell = cell as? ScalingCarouselCell {
scalingCell.mainView.backgroundColor = .blue
}
DispatchQueue.main.async {
cell.setNeedsLayout()
cell.layoutIfNeeded()
}
return cell
}
}
+3 -1
View File
@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.2</string>
<string>2.4</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
@@ -25,6 +25,8 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
@@ -30,7 +30,11 @@ class StoryboardViewController: UIViewController {
carouselBottomConstraint.constant = Constants.carouselHideConstant
}
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
carousel.deviceRotated()
}
// MARK: - Button Actions
@IBAction func showHideButtonPressed(_ sender: Any) {
@@ -56,6 +60,11 @@ extension CarouselDatasource: UICollectionViewDataSource {
if let scalingCell = cell as? ScalingCarouselCell {
scalingCell.mainView.backgroundColor = .red
}
DispatchQueue.main.async {
cell.setNeedsLayout()
cell.layoutIfNeeded()
}
return cell
}
-24
View File
@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
-29
View File
@@ -1,29 +0,0 @@
import UIKit
import XCTest
import ScalingCarousel
class Tests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
XCTAssert(true, "Pass")
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure() {
// Put the code you want to measure the time of here.
}
}
}
+22
View File
@@ -38,6 +38,12 @@ This property is declared in ScalingCarouselCell. You should add any cell conten
cell.setNeedsLayout()
cell.layoutIfNeeded()
```
* Note: To ensure correct displayed of the ScalingCarousel, you need to call the following code in the method `viewWillTransition(to size:, with coordinator:)` of the ViewController:
```
super.viewWillTransition(to: size, with: coordinator)
scalingCarousel.deviceRotated()
```
### Code
@@ -50,6 +56,13 @@ override init(frame: CGRect) {
// Initialize the mainView property and add it to the cell's contentView
mainView = UIView(frame: contentView.bounds)
contentView.addSubview(mainView)
mainView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
mainView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
mainView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
mainView.topAnchor.constraint(equalTo: contentView.topAnchor),
mainView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor)
])
}
```
@@ -82,6 +95,15 @@ scalingCarousel.topAnchor.constraint(equalTo: view.topAnchor, constant: 50).isAc
```
cell.setNeedsLayout()
cell.layoutIfNeeded()
```
* Note: To ensure correct displayed of the ScalingCarousel, you need to call the following code in the method `viewWillTransition(to size:, with coordinator:)` of the ViewController, If you have created the ScalingCarousel by code in the viewDidLoad, It is important to verify that it exists when the method `viewWillTransition` is called or we will have a crash if we load the viewController with the device in landscape mode:
```
super.viewWillTransition(to: size, with: coordinator)
if scalingCarousel != nil {
scalingCarousel.deviceRotated()
}
```
## Example
+2 -2
View File
@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = 'ScalingCarousel'
s.version = '2.2'
s.version = '2.4'
s.summary = 'A super simple carousel view with scaling transitions written in Swift'
s.description = <<-DESC
@@ -25,7 +25,7 @@ It is used in Bikey to present bike station information.
s.source = { :git => 'https://github.com/superpeteblaze/ScalingCarousel.git', :tag => "v#{s.version.to_s}" }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.ios.deployment_target = '9.0'
s.ios.deployment_target = '10.0'
s.source_files = 'ScalingCarousel/Classes/**/*'
end
@@ -23,11 +23,11 @@ open class ScalingCarouselCell: UICollectionViewCell {
// MARK: - Properties (Public)
/// The minimum value to scale to, should be set between 0 and 1
open var scaleMinimum: CGFloat = 0.9
open var scaleMinimum: CGFloat = 0.7
/// Divisior used when calculating the scale value.
/// Lower values cause a greater difference in scale between subsequent cells.
open var scaleDivisor: CGFloat = 10.0
open var scaleDivisor: CGFloat = 8.0
/// The minimum value to alpha to, should be set between 0 and 1
open var alphaMinimum: CGFloat = 0.85
@@ -71,7 +71,7 @@ open class ScalingCarouselCell: UICollectionViewCell {
let width = frame.size.width
// Calculate our scale values
let scaleCalculator = fabs(width - fabs(originXActual))
let scaleCalculator = abs(width - abs(originXActual))
let percentageScale = (scaleCalculator/width)
let scaleValue = scaleMinimum
@@ -16,7 +16,11 @@ import UIKit
are scaled as the carousel scrolls.
*/
open class ScalingCarouselView: UICollectionView {
// MARK: - Properties (Private)
private var lastCurrentCenterCellIndex: IndexPath?
// MARK: - Properties (Public)
/// Inset of the main, center cell
@@ -112,12 +116,13 @@ open class ScalingCarouselView: UICollectionView {
invisibleScrollView.setContentOffset(rect.origin, animated: animated)
}
override open func scrollToItem(at indexPath: IndexPath, at scrollPosition: UICollectionViewScrollPosition, animated: Bool) {
override open func scrollToItem(at indexPath: IndexPath, at scrollPosition: UICollectionView.ScrollPosition, animated: Bool) {
super.scrollToItem(at: indexPath, at: scrollPosition, animated: animated)
let originX = (CGFloat(indexPath.item) * (frame.size.width - (inset * 2)))
let rect = CGRect(x: originX, y: 0, width: frame.size.width - (inset * 2), height: frame.height)
scrollRectToVisible(rect, animated: animated)
lastCurrentCenterCellIndex = indexPath
}
override open func didMoveToSuperview() {
@@ -141,6 +146,26 @@ open class ScalingCarouselView: UICollectionView {
public func didScroll() {
scrollViewDidScroll(self)
}
/*
This method should ALWAYS be called from the ViewController that handles the ScalingCarousel when
the viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) method is called
e.g Implement:
func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
carousel.deviceRotated()
}
*/
public func deviceRotated() {
guard let lastCurrentCenterCellIndex = currentCenterCellIndex ?? lastCurrentCenterCellIndex else { return }
DispatchQueue.main.async {
self.reloadData()
self.scrollToItem(at: lastCurrentCenterCellIndex, at: .centeredHorizontally, animated: false)
self.didScroll()
}
}
}
private typealias PrivateAPI = ScalingCarouselView
@@ -245,6 +270,8 @@ extension InvisibleScrollDelegate: UIScrollViewDelegate {
public func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
delegate?.scrollViewDidEndDecelerating?(scrollView)
guard let indexPath = currentCenterCellIndex else { return }
lastCurrentCenterCellIndex = indexPath
}
private func updateOffSet() {