diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1acfc17 --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +# OS X +.DS_Store + +# Xcode +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +*.xccheckout +profile +*.moved-aside +DerivedData +*.hmap +*.ipa +*.xcworkspace + +# Bundler +.bundle + +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control +# +# Note: if you ignore the Pods directory, make sure to uncomment +# `pod install` in .travis.yml +# +Pods/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..41e54f2 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,15 @@ +# references: +# * http://www.objc.io/issue-6/travis-ci.html +# * https://github.com/supermarin/xcpretty#usage + +language: objective-c +# cache: cocoapods +# podfile: Example/Podfile +# before_install: +# - gem install cocoapods # Since Travis is not always on latest version +# - pod install --project-directory=Example +install: +- gem install xcpretty --no-rdoc --no-ri --no-document --quiet +script: +- set -o pipefail && xcodebuild test -workspace Example/PhotoSlider.xcworkspace -scheme PhotoSlider-Example -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty -c +- pod lib lint --quick diff --git a/Example/PhotoSliderDemo.xcodeproj/project.pbxproj b/Example/PhotoSliderDemo.xcodeproj/project.pbxproj new file mode 100644 index 0000000..73d10c0 --- /dev/null +++ b/Example/PhotoSliderDemo.xcodeproj/project.pbxproj @@ -0,0 +1,564 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 965C495DE0B350CAA38C7A20 /* Pods_PhotoSliderDemoTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 689274A363491ABEA8D3598A /* Pods_PhotoSliderDemoTests.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + D8B794C512AAA0D057DE04F8 /* Pods_PhotoSliderDemo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 191D9A2EE675029B0F5FAEC1 /* Pods_PhotoSliderDemo.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + DC20F45D1ADA871D009A4C64 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC20F45C1ADA871D009A4C64 /* AppDelegate.swift */; }; + DC20F45F1ADA871D009A4C64 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC20F45E1ADA871D009A4C64 /* ViewController.swift */; }; + DC20F4621ADA871D009A4C64 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DC20F4601ADA871D009A4C64 /* Main.storyboard */; }; + DC20F4641ADA871D009A4C64 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DC20F4631ADA871D009A4C64 /* Images.xcassets */; }; + DC20F4671ADA871D009A4C64 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = DC20F4651ADA871D009A4C64 /* LaunchScreen.xib */; }; + DC20F4731ADA871D009A4C64 /* PhotoSliderDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC20F4721ADA871D009A4C64 /* PhotoSliderDemoTests.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + DC20F46D1ADA871D009A4C64 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = DC20F44F1ADA871D009A4C64 /* Project object */; + proxyType = 1; + remoteGlobalIDString = DC20F4561ADA871D009A4C64; + remoteInfo = PhotoSliderDemo; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 191D9A2EE675029B0F5FAEC1 /* Pods_PhotoSliderDemo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PhotoSliderDemo.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 41089CB75B56F12DC715DE50 /* Pods-PhotoSliderDemoTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PhotoSliderDemoTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-PhotoSliderDemoTests/Pods-PhotoSliderDemoTests.release.xcconfig"; sourceTree = ""; }; + 48954EE5BD7E332C65202083 /* Pods-PhotoSliderDemoTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PhotoSliderDemoTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-PhotoSliderDemoTests/Pods-PhotoSliderDemoTests.debug.xcconfig"; sourceTree = ""; }; + 689274A363491ABEA8D3598A /* Pods_PhotoSliderDemoTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PhotoSliderDemoTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + CAA14BFE259FFFFA34A7158C /* Pods-PhotoSliderDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PhotoSliderDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-PhotoSliderDemo/Pods-PhotoSliderDemo.release.xcconfig"; sourceTree = ""; }; + CF4EE87704D26443EB7CA776 /* Pods-PhotoSliderDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PhotoSliderDemo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-PhotoSliderDemo/Pods-PhotoSliderDemo.debug.xcconfig"; sourceTree = ""; }; + DC20F4571ADA871D009A4C64 /* PhotoSliderDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PhotoSliderDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DC20F45B1ADA871D009A4C64 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + DC20F45C1ADA871D009A4C64 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + DC20F45E1ADA871D009A4C64 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + DC20F4611ADA871D009A4C64 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + DC20F4631ADA871D009A4C64 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + DC20F4661ADA871D009A4C64 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; + DC20F46C1ADA871D009A4C64 /* PhotoSliderDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PhotoSliderDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + DC20F4711ADA871D009A4C64 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + DC20F4721ADA871D009A4C64 /* PhotoSliderDemoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoSliderDemoTests.swift; sourceTree = ""; }; + DC20F4801ADA9657009A4C64 /* PhotoSliderDemo-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "PhotoSliderDemo-Bridging-Header.h"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + DC20F4541ADA871D009A4C64 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D8B794C512AAA0D057DE04F8 /* Pods_PhotoSliderDemo.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + DC20F4691ADA871D009A4C64 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 965C495DE0B350CAA38C7A20 /* Pods_PhotoSliderDemoTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 66A3BAA23076667DA79DC70A /* Frameworks */ = { + isa = PBXGroup; + children = ( + 191D9A2EE675029B0F5FAEC1 /* Pods_PhotoSliderDemo.framework */, + 689274A363491ABEA8D3598A /* Pods_PhotoSliderDemoTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 9BF74163E5DA4094004C64A0 /* Pods */ = { + isa = PBXGroup; + children = ( + CF4EE87704D26443EB7CA776 /* Pods-PhotoSliderDemo.debug.xcconfig */, + CAA14BFE259FFFFA34A7158C /* Pods-PhotoSliderDemo.release.xcconfig */, + 48954EE5BD7E332C65202083 /* Pods-PhotoSliderDemoTests.debug.xcconfig */, + 41089CB75B56F12DC715DE50 /* Pods-PhotoSliderDemoTests.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + DC20F44E1ADA871D009A4C64 = { + isa = PBXGroup; + children = ( + DC20F4591ADA871D009A4C64 /* PhotoSliderDemo */, + DC20F46F1ADA871D009A4C64 /* PhotoSliderDemoTests */, + DC20F4581ADA871D009A4C64 /* Products */, + 9BF74163E5DA4094004C64A0 /* Pods */, + 66A3BAA23076667DA79DC70A /* Frameworks */, + ); + sourceTree = ""; + }; + DC20F4581ADA871D009A4C64 /* Products */ = { + isa = PBXGroup; + children = ( + DC20F4571ADA871D009A4C64 /* PhotoSliderDemo.app */, + DC20F46C1ADA871D009A4C64 /* PhotoSliderDemoTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + DC20F4591ADA871D009A4C64 /* PhotoSliderDemo */ = { + isa = PBXGroup; + children = ( + DC20F45C1ADA871D009A4C64 /* AppDelegate.swift */, + DC20F45E1ADA871D009A4C64 /* ViewController.swift */, + DC20F4601ADA871D009A4C64 /* Main.storyboard */, + DC20F4631ADA871D009A4C64 /* Images.xcassets */, + DC20F4651ADA871D009A4C64 /* LaunchScreen.xib */, + DC20F45A1ADA871D009A4C64 /* Supporting Files */, + ); + path = PhotoSliderDemo; + sourceTree = ""; + }; + DC20F45A1ADA871D009A4C64 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + DC20F45B1ADA871D009A4C64 /* Info.plist */, + DC20F4801ADA9657009A4C64 /* PhotoSliderDemo-Bridging-Header.h */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + DC20F46F1ADA871D009A4C64 /* PhotoSliderDemoTests */ = { + isa = PBXGroup; + children = ( + DC20F4721ADA871D009A4C64 /* PhotoSliderDemoTests.swift */, + DC20F4701ADA871D009A4C64 /* Supporting Files */, + ); + path = PhotoSliderDemoTests; + sourceTree = ""; + }; + DC20F4701ADA871D009A4C64 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + DC20F4711ADA871D009A4C64 /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + DC20F4561ADA871D009A4C64 /* PhotoSliderDemo */ = { + isa = PBXNativeTarget; + buildConfigurationList = DC20F4761ADA871D009A4C64 /* Build configuration list for PBXNativeTarget "PhotoSliderDemo" */; + buildPhases = ( + C09C446FE462AFCDBA7FD924 /* Check Pods Manifest.lock */, + DC20F4531ADA871D009A4C64 /* Sources */, + DC20F4541ADA871D009A4C64 /* Frameworks */, + DC20F4551ADA871D009A4C64 /* Resources */, + 2485CC77A70B7A6DE7448FF7 /* Embed Pods Frameworks */, + 59CC92A4452E8AAC945F4669 /* Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = PhotoSliderDemo; + productName = PhotoSliderDemo; + productReference = DC20F4571ADA871D009A4C64 /* PhotoSliderDemo.app */; + productType = "com.apple.product-type.application"; + }; + DC20F46B1ADA871D009A4C64 /* PhotoSliderDemoTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = DC20F4791ADA871D009A4C64 /* Build configuration list for PBXNativeTarget "PhotoSliderDemoTests" */; + buildPhases = ( + 7D1196F87634C1D409F3D0CA /* Check Pods Manifest.lock */, + DC20F4681ADA871D009A4C64 /* Sources */, + DC20F4691ADA871D009A4C64 /* Frameworks */, + DC20F46A1ADA871D009A4C64 /* Resources */, + 750F900D03ABCA3B7E7C365C /* Embed Pods Frameworks */, + 6B2CA360EAE21A8576BA873D /* Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + DC20F46E1ADA871D009A4C64 /* PBXTargetDependency */, + ); + name = PhotoSliderDemoTests; + productName = PhotoSliderDemoTests; + productReference = DC20F46C1ADA871D009A4C64 /* PhotoSliderDemoTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + DC20F44F1ADA871D009A4C64 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0620; + ORGANIZATIONNAME = net.nakajijapan; + TargetAttributes = { + DC20F4561ADA871D009A4C64 = { + CreatedOnToolsVersion = 6.2; + }; + DC20F46B1ADA871D009A4C64 = { + CreatedOnToolsVersion = 6.2; + TestTargetID = DC20F4561ADA871D009A4C64; + }; + }; + }; + buildConfigurationList = DC20F4521ADA871D009A4C64 /* Build configuration list for PBXProject "PhotoSliderDemo" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = DC20F44E1ADA871D009A4C64; + productRefGroup = DC20F4581ADA871D009A4C64 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + DC20F4561ADA871D009A4C64 /* PhotoSliderDemo */, + DC20F46B1ADA871D009A4C64 /* PhotoSliderDemoTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + DC20F4551ADA871D009A4C64 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DC20F4621ADA871D009A4C64 /* Main.storyboard in Resources */, + DC20F4671ADA871D009A4C64 /* LaunchScreen.xib in Resources */, + DC20F4641ADA871D009A4C64 /* Images.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + DC20F46A1ADA871D009A4C64 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 2485CC77A70B7A6DE7448FF7 /* Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-PhotoSliderDemo/Pods-PhotoSliderDemo-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 59CC92A4452E8AAC945F4669 /* Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-PhotoSliderDemo/Pods-PhotoSliderDemo-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 6B2CA360EAE21A8576BA873D /* Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-PhotoSliderDemoTests/Pods-PhotoSliderDemoTests-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 750F900D03ABCA3B7E7C365C /* Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-PhotoSliderDemoTests/Pods-PhotoSliderDemoTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 7D1196F87634C1D409F3D0CA /* Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + C09C446FE462AFCDBA7FD924 /* Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + DC20F4531ADA871D009A4C64 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DC20F45F1ADA871D009A4C64 /* ViewController.swift in Sources */, + DC20F45D1ADA871D009A4C64 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + DC20F4681ADA871D009A4C64 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DC20F4731ADA871D009A4C64 /* PhotoSliderDemoTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + DC20F46E1ADA871D009A4C64 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = DC20F4561ADA871D009A4C64 /* PhotoSliderDemo */; + targetProxy = DC20F46D1ADA871D009A4C64 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + DC20F4601ADA871D009A4C64 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + DC20F4611ADA871D009A4C64 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + DC20F4651ADA871D009A4C64 /* LaunchScreen.xib */ = { + isa = PBXVariantGroup; + children = ( + DC20F4661ADA871D009A4C64 /* Base */, + ); + name = LaunchScreen.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + DC20F4741ADA871D009A4C64 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.2; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + DC20F4751ADA871D009A4C64 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.2; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + DC20F4771ADA871D009A4C64 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = CF4EE87704D26443EB7CA776 /* Pods-PhotoSliderDemo.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + INFOPLIST_FILE = PhotoSliderDemo/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "PhotoSliderDemo/PhotoSliderDemo-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + DC20F4781ADA871D009A4C64 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = CAA14BFE259FFFFA34A7158C /* Pods-PhotoSliderDemo.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + INFOPLIST_FILE = PhotoSliderDemo/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "PhotoSliderDemo/PhotoSliderDemo-Bridging-Header.h"; + }; + name = Release; + }; + DC20F47A1ADA871D009A4C64 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 48954EE5BD7E332C65202083 /* Pods-PhotoSliderDemoTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = PhotoSliderDemoTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PhotoSliderDemo.app/PhotoSliderDemo"; + }; + name = Debug; + }; + DC20F47B1ADA871D009A4C64 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 41089CB75B56F12DC715DE50 /* Pods-PhotoSliderDemoTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + INFOPLIST_FILE = PhotoSliderDemoTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PhotoSliderDemo.app/PhotoSliderDemo"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + DC20F4521ADA871D009A4C64 /* Build configuration list for PBXProject "PhotoSliderDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DC20F4741ADA871D009A4C64 /* Debug */, + DC20F4751ADA871D009A4C64 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + DC20F4761ADA871D009A4C64 /* Build configuration list for PBXNativeTarget "PhotoSliderDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DC20F4771ADA871D009A4C64 /* Debug */, + DC20F4781ADA871D009A4C64 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + DC20F4791ADA871D009A4C64 /* Build configuration list for PBXNativeTarget "PhotoSliderDemoTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DC20F47A1ADA871D009A4C64 /* Debug */, + DC20F47B1ADA871D009A4C64 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = DC20F44F1ADA871D009A4C64 /* Project object */; +} diff --git a/Example/PhotoSliderDemo/AppDelegate.swift b/Example/PhotoSliderDemo/AppDelegate.swift new file mode 100644 index 0000000..621ff5e --- /dev/null +++ b/Example/PhotoSliderDemo/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// PhotoSliderDemo +// +// Created by nakajijapan on 4/12/15. +// Copyright (c) 2015 net.nakajijapan. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(application: UIApplication) { + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/Example/PhotoSliderDemo/Base.lproj/LaunchScreen.xib b/Example/PhotoSliderDemo/Base.lproj/LaunchScreen.xib new file mode 100644 index 0000000..bbb3cbb --- /dev/null +++ b/Example/PhotoSliderDemo/Base.lproj/LaunchScreen.xib @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/PhotoSliderDemo/Base.lproj/Main.storyboard b/Example/PhotoSliderDemo/Base.lproj/Main.storyboard new file mode 100644 index 0000000..e9cb3ff --- /dev/null +++ b/Example/PhotoSliderDemo/Base.lproj/Main.storyboard @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/PhotoSliderDemo/Images.xcassets/AppIcon.appiconset/Contents.json b/Example/PhotoSliderDemo/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..118c98f --- /dev/null +++ b/Example/PhotoSliderDemo/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,38 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/PhotoSliderDemo/Info.plist b/Example/PhotoSliderDemo/Info.plist new file mode 100644 index 0000000..c821123 --- /dev/null +++ b/Example/PhotoSliderDemo/Info.plist @@ -0,0 +1,40 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + net.nakajijapan.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Example/PhotoSliderDemo/PhotoSliderDemo-Bridging-Header.h b/Example/PhotoSliderDemo/PhotoSliderDemo-Bridging-Header.h new file mode 100644 index 0000000..fb4e938 --- /dev/null +++ b/Example/PhotoSliderDemo/PhotoSliderDemo-Bridging-Header.h @@ -0,0 +1,13 @@ +// +// PhotoSliderDemo-Bridging-Header.h +// PhotoSliderDemo +// +// Created by nakajijapan on 4/12/15. +// Copyright (c) 2015 net.nakajijapan. All rights reserved. +// + +#ifndef PhotoSliderDemo_PhotoSliderDemo_Bridging_Header_h +#define PhotoSliderDemo_PhotoSliderDemo_Bridging_Header_h + + +#endif diff --git a/Example/PhotoSliderDemo/ViewController.swift b/Example/PhotoSliderDemo/ViewController.swift new file mode 100644 index 0000000..06906b7 --- /dev/null +++ b/Example/PhotoSliderDemo/ViewController.swift @@ -0,0 +1,86 @@ +// +// ViewController.swift +// PhotoSliderDemo +// +// Created by nakajijapan on 4/12/15. +// Copyright (c) 2015 net.nakajijapan. All rights reserved. +// + +import UIKit +import PhotoSlider + +class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout { + + @IBOutlet var tableView:UITableView! + + var collectionView:UICollectionView! + + var images = [ + "https://raw.githubusercontent.com/nakajijapan/PhotoSlider/master/Example/Resources/image001.jpg", + "https://raw.githubusercontent.com/nakajijapan/PhotoSlider/master/Example/Resources/image002.jpg", + "https://raw.githubusercontent.com/nakajijapan/PhotoSlider/master/Example/Resources/image003.jpg", + "https://raw.githubusercontent.com/nakajijapan/PhotoSlider/master/Example/Resources/image004.jpg", + "https://raw.githubusercontent.com/nakajijapan/PhotoSlider/master/Example/Resources/image005.jpg", + "https://raw.githubusercontent.com/nakajijapan/PhotoSlider/master/Example/Resources/image006.jpg", + "https://raw.githubusercontent.com/nakajijapan/PhotoSlider/master/Example/Resources/image007.jpg", + "https://raw.githubusercontent.com/nakajijapan/PhotoSlider/master/Example/Resources/image008.jpg", + ] + + // MARK: - UITableViewDataSource + + func numberOfSectionsInTableView(tableView: UITableView) -> Int { + return 1 + } + + func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return 1 + } + + func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { + var cell = self.tableView.dequeueReusableCellWithIdentifier("cell01") as UITableViewCell + + var collectionView = cell.viewWithTag(1) as UICollectionView + collectionView.delegate = self + collectionView.dataSource = self + + return cell + } + + // MARK: - UICollectionViewDataSource + + func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { + return 1 + } + + func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return self.images.count + } + + func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { + var cell = collectionView.dequeueReusableCellWithReuseIdentifier("hcell", forIndexPath: indexPath) as UICollectionViewCell + + var imageView = cell.viewWithTag(1) as UIImageView + imageView.sd_setImageWithURL(NSURL(string: self.images[indexPath.row])!) + + return cell + } + + func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize { + return CGSize(width:UIScreen.mainScreen().bounds.size.width, height:UIScreen.mainScreen().bounds.size.width) + } + + // MARK: - UICollectionViewDelegate + + func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) { + + var slider = PhotoSlider.ViewController(imageURLs: self.images) + slider.modalPresentationStyle = .OverCurrentContext + slider.modalTransitionStyle = UIModalTransitionStyle.CrossDissolve + slider.index = indexPath.row + self.presentViewController(slider, animated: true) { () -> Void in + // none + } + } +} + + diff --git a/Example/PhotoSliderDemoTests/Info.plist b/Example/PhotoSliderDemoTests/Info.plist new file mode 100644 index 0000000..0f98644 --- /dev/null +++ b/Example/PhotoSliderDemoTests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + net.nakajijapan.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/Example/PhotoSliderDemoTests/PhotoSliderDemoTests.swift b/Example/PhotoSliderDemoTests/PhotoSliderDemoTests.swift new file mode 100644 index 0000000..84606a0 --- /dev/null +++ b/Example/PhotoSliderDemoTests/PhotoSliderDemoTests.swift @@ -0,0 +1,36 @@ +// +// PhotoSliderDemoTests.swift +// PhotoSliderDemoTests +// +// Created by nakajijapan on 4/12/15. +// Copyright (c) 2015 net.nakajijapan. All rights reserved. +// + +import UIKit +import XCTest + +class PhotoSliderDemoTests: 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.measureBlock() { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/Example/Podfile b/Example/Podfile new file mode 100644 index 0000000..dd61c94 --- /dev/null +++ b/Example/Podfile @@ -0,0 +1,15 @@ +source 'https://github.com/CocoaPods/Specs.git' + +platform :ios, "8.0" +use_frameworks! + +target 'PhotoSliderDemo', :exclusive => true do + pod "PhotoSlider", :path => "../" + pod 'SDWebImage' +end + +target 'PhotoSliderDemoTests', :exclusive => true do + pod "PhotoSlider", :path => "../" + pod 'SDWebImage' + pod 'FBSnapshotTestCase' +end diff --git a/Example/Podfile.lock b/Example/Podfile.lock new file mode 100644 index 0000000..42d9d0c --- /dev/null +++ b/Example/Podfile.lock @@ -0,0 +1,23 @@ +PODS: + - FBSnapshotTestCase (1.6) + - PhotoSlider (0.1.0): + - SDWebImage + - SDWebImage (3.7.2): + - SDWebImage/Core (= 3.7.2) + - SDWebImage/Core (3.7.2) + +DEPENDENCIES: + - FBSnapshotTestCase + - PhotoSlider (from `../`) + - SDWebImage + +EXTERNAL SOURCES: + PhotoSlider: + :path: "../" + +SPEC CHECKSUMS: + FBSnapshotTestCase: 9d5fe43b29ae3a0ed8fc829477971b281038f748 + PhotoSlider: 86567d75a8917a0e7f5acbd7edab3634db1c1916 + SDWebImage: 71b7cdc1d1721d6a82ed62889030225f2c249e29 + +COCOAPODS: 0.36.3 diff --git a/Example/Resources/image001.jpg b/Example/Resources/image001.jpg new file mode 100644 index 0000000..775f84f Binary files /dev/null and b/Example/Resources/image001.jpg differ diff --git a/Example/Resources/image002.jpg b/Example/Resources/image002.jpg new file mode 100644 index 0000000..5db4a77 Binary files /dev/null and b/Example/Resources/image002.jpg differ diff --git a/Example/Resources/image003.jpg b/Example/Resources/image003.jpg new file mode 100644 index 0000000..7286d06 Binary files /dev/null and b/Example/Resources/image003.jpg differ diff --git a/Example/Resources/image004.jpg b/Example/Resources/image004.jpg new file mode 100644 index 0000000..b5260db Binary files /dev/null and b/Example/Resources/image004.jpg differ diff --git a/Example/Resources/image005.jpg b/Example/Resources/image005.jpg new file mode 100644 index 0000000..d8c308c Binary files /dev/null and b/Example/Resources/image005.jpg differ diff --git a/Example/Resources/image006.jpg b/Example/Resources/image006.jpg new file mode 100644 index 0000000..db7de52 Binary files /dev/null and b/Example/Resources/image006.jpg differ diff --git a/Example/Resources/image007.jpg b/Example/Resources/image007.jpg new file mode 100644 index 0000000..812a53c Binary files /dev/null and b/Example/Resources/image007.jpg differ diff --git a/Example/Resources/image008.jpg b/Example/Resources/image008.jpg new file mode 100644 index 0000000..d5ef9ba Binary files /dev/null and b/Example/Resources/image008.jpg differ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ff17750 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 nakajijapan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/PhotoSlider.podspec b/PhotoSlider.podspec new file mode 100644 index 0000000..dc4239c --- /dev/null +++ b/PhotoSlider.podspec @@ -0,0 +1,32 @@ +# +# Be sure to run `pod lib lint PhotoSlider.podspec' to ensure this is a +# valid spec and remove all comments before submitting the spec. +# +# Any lines starting with a # are optional, but encouraged +# +# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html +# + +Pod::Spec.new do |s| + s.name = "PhotoSlider" + s.version = "0.1.0" + s.summary = "PhotoSlider can a simple photo slider and delete slider with swiping." + s.homepage = "https://github.com/nakajijapan/PhotoSlider" + # s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2" + s.license = 'MIT' + s.author = { "nakajijapan" => "pp.kupepo.gattyanmo@gmail.com" } + s.source = { :git => "https://github.com/nakajijapan/PhotoSlider.git", :tag => s.version.to_s } + s.social_media_url = 'https://twitter.com/nakajijapan' + + s.platform = :ios, '8.0' + s.requires_arc = true + + s.source_files = 'Pod/Classes/**/*' + s.resource_bundles = { + 'PhotoSlider' => ['Pod/Assets/*.png'] + } + + # s.public_header_files = 'Pod/Classes/**/*.h' + #s.frameworks = 'UIKit', 'MapKit' + s.dependency 'SDWebImage' +end diff --git a/Pod/Assets/.gitkeep b/Pod/Assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Pod/Classes/.gitkeep b/Pod/Classes/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Pod/Classes/CollectionViewCell.swift b/Pod/Classes/CollectionViewCell.swift new file mode 100644 index 0000000..d570eb1 --- /dev/null +++ b/Pod/Classes/CollectionViewCell.swift @@ -0,0 +1,26 @@ +// +// CollectionViewCell.swift +// +// Created by nakajijapan on 3/29/15. +// Copyright (c) 2015 net.nakajijapan. All rights reserved. +// + +import UIKit + +class CollectionViewCell: UICollectionViewCell { + + var imageView: PhotoSlider.ImageView! + + override init(frame: CGRect) { + super.init(frame: frame) + self.imageView = PhotoSlider.ImageView(frame: self.bounds) + self.addSubview(self.imageView) + } + + required init(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + self.imageView = PhotoSlider.ImageView(frame: self.bounds) + self.addSubview(self.imageView) + } + +} diff --git a/Pod/Classes/ImageView.swift b/Pod/Classes/ImageView.swift new file mode 100644 index 0000000..c01a39d --- /dev/null +++ b/Pod/Classes/ImageView.swift @@ -0,0 +1,62 @@ +// +// ImageView.swift +// +// Created by nakajijapan on 3/29/15. +// Copyright (c) 2015 net.nakajijapan. All rights reserved. +// + +import UIKit + +class ImageView: UIView, UIScrollViewDelegate { + + var imageView:UIImageView! + var scrollView:UIScrollView! + //var delegate: + + override init(frame: CGRect) { + super.init(frame: frame) + self.initialize() + } + + required init(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + self.initialize() + } + + func initialize() { + self.scrollView = UIScrollView(frame: self.bounds) + self.scrollView.showsHorizontalScrollIndicator = false + self.scrollView.showsVerticalScrollIndicator = false + self.scrollView.minimumZoomScale = 1.0 + self.scrollView.maximumZoomScale = 3.0 + self.scrollView.bounces = true + self.scrollView.delegate = self + + self.backgroundColor = UIColor.clearColor() + + self.imageView = UIImageView(frame: self.bounds) + self.imageView.contentMode = UIViewContentMode.ScaleAspectFit + self.imageView.userInteractionEnabled = true + + self.userInteractionEnabled = true + self.addSubview(self.scrollView) + self.scrollView.addSubview(self.imageView) + + let doubleTabGesture = UITapGestureRecognizer(target: self, action: "didDoubleTap:") + doubleTabGesture.numberOfTapsRequired = 2 + self.addGestureRecognizer(doubleTabGesture) + } + + func didDoubleTap(sender: UIGestureRecognizer) { + if self.scrollView.zoomScale == 1.0 { + self.scrollView.setZoomScale(2.0, animated: true) + } else { + self.scrollView.setZoomScale(0.0, animated: true) + } + } + + func viewForZoomingInScrollView(scrollView: UIScrollView) -> UIView? { + return self.imageView + } + +} diff --git a/Pod/Classes/ViewController.swift b/Pod/Classes/ViewController.swift new file mode 100644 index 0000000..83a4079 --- /dev/null +++ b/Pod/Classes/ViewController.swift @@ -0,0 +1,161 @@ +// +// ViewController.swift +// +// Created by nakajijapan on 3/28/15. +// Copyright (c) 2015 net.nakajijapan. All rights reserved. +// + +import UIKit +import SDWebImage + +public class ViewController:UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout { + + var collectionView: UICollectionView! + var imageURLs:Array? + + public var index:Int = 0 + public init(imageURLs:Array) { + super.init() + self.imageURLs = imageURLs + } + + required public init(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + } + + override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) { + super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) + } + + public override func viewDidLoad() { + super.viewDidLoad() + + self.view.frame = UIScreen.mainScreen().bounds + self.view.backgroundColor = UIColor.clearColor() + self.view.userInteractionEnabled = true + + var bgView = UIView(frame: self.view.bounds) + bgView.backgroundColor = UIColor.blackColor() + bgView.alpha = 0.7; + self.view.addSubview(bgView) + + // layout + let layout = UICollectionViewFlowLayout() + layout.scrollDirection = UICollectionViewScrollDirection.Horizontal + layout.minimumInteritemSpacing = 0; + layout.minimumLineSpacing = 0; + + //collectionView + self.collectionView = UICollectionView(frame: self.view.bounds, collectionViewLayout: layout) + self.collectionView.registerClass(CollectionViewCell.self, forCellWithReuseIdentifier: "cell") + self.collectionView.pagingEnabled = true + self.collectionView.delegate = self + self.collectionView.dataSource = self + self.collectionView.bounces = true + self.collectionView.backgroundColor = UIColor.clearColor() + self.collectionView.showsHorizontalScrollIndicator = true + self.collectionView.alwaysBounceVertical = true + self.view.addSubview(self.collectionView) + + } + + override public func viewWillAppear(animated: Bool) { + let indexPath = NSIndexPath(forItem: self.index, inSection: 0) + self.collectionView.scrollToItemAtIndexPath(indexPath, atScrollPosition: UICollectionViewScrollPosition.None, animated: false) + } + + override public func touchesBegan(touches: NSSet, withEvent event: UIEvent) { + + self.dismissViewControllerAnimated(true) { () -> Void in + self.view.removeFromSuperview() + } + + } + + // MARK: - UICollectionViewDataSource + + public func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { + return 1 + } + + public func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return self.imageURLs!.count + } + + public func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { + + var cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as CollectionViewCell + cell.backgroundColor = UIColor.clearColor() + + if self.imageURLs != nil { + let imageURL = NSURL(string: self.imageURLs![indexPath.row])! + cell.imageView.imageView.sd_setImageWithURL(imageURL) + } + + return cell + } + + public func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize { + return self.view.bounds.size + } + + // MARK: - UIScrollViewDelegate + var scrollPreviewPoint = CGPointZero; + public func scrollViewWillBeginDragging(scrollView: UIScrollView) { + self.scrollPreviewPoint = scrollView.contentOffset + } + + public func scrollViewDidScroll(scrollView: UIScrollView) { + + let screenHeight = UIScreen.mainScreen().bounds.size.height + let screenWidth = UIScreen.mainScreen().bounds.size.width + + + if scrollView.contentOffset.y > 100 { + + self.collectionView.frame = scrollView.frame + UIView.animateWithDuration( + 0.5, + delay: 0, + options: UIViewAnimationOptions.CurveEaseOut, + animations: { () -> Void in + self.collectionView.frame = CGRectMake(0, -screenHeight, screenWidth, screenHeight) + self.dismissViewControllerAnimated(true, completion: nil) + }, + completion: nil + ) + return + + } else if scrollView.contentOffset.y < -100 { + + self.collectionView.frame = scrollView.frame + UIView.animateWithDuration( + 0.5, + delay: 0, + options: UIViewAnimationOptions.CurveEaseOut, + animations: { () -> Void in + self.collectionView.frame = CGRectMake(0, screenHeight, screenWidth, screenHeight) + self.dismissViewControllerAnimated(true, completion: nil) + }, + completion: nil + ) + + return + } + + var offsetX = fabs(scrollView.contentOffset.x - self.scrollPreviewPoint.x) + var offsetY = fabs(scrollView.contentOffset.y - self.scrollPreviewPoint.y) + if offsetY > offsetX { + var contentOffset = scrollView.contentOffset + contentOffset.x = self.scrollPreviewPoint.x + scrollView.contentOffset = contentOffset + } else { + var contentOffset = scrollView.contentOffset + contentOffset.y = self.scrollPreviewPoint.y + scrollView.contentOffset = contentOffset + } + + + } + +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..65f0315 --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# PhotoSlider + +[![CI Status](http://img.shields.io/travis/nakajijapan/PhotoSlider.svg?style=flat)](https://travis-ci.org/nakajijapan/PhotoSlider) +[![Version](https://img.shields.io/cocoapods/v/PhotoSlider.svg?style=flat)](http://cocoapods.org/pods/PhotoSlider) +[![License](https://img.shields.io/cocoapods/l/PhotoSlider.svg?style=flat)](http://cocoapods.org/pods/PhotoSlider) +[![Platform](https://img.shields.io/cocoapods/p/PhotoSlider.svg?style=flat)](http://cocoapods.org/pods/PhotoSlider) + +## Usage + +To run the example project, clone the repo, and run `pod install` from the Example directory first. + +## Requirements + +## Installation + +PhotoSlider is available through [CocoaPods](http://cocoapods.org). To install +it, simply add the following line to your Podfile: + +```ruby +pod "PhotoSlider" +``` + +## Author + +nakajijapan, pp.kupepo.gattyanmo@gmail.com + +## License + +PhotoSlider is available under the MIT license. See the LICENSE file for more info.