diff --git a/.gitignore b/.gitignore index 40b64a0..91fef9b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +# OS X + +.DS_Store + # Xcode build/ diff --git a/Assets/1.gif b/Assets/1.gif index bbbc962..080702e 100644 Binary files a/Assets/1.gif and b/Assets/1.gif differ diff --git a/LICENSE b/LICENSE index 990946e..d8ebf61 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,7 @@ The MIT License (MIT) -Copyright (c) 2015 David Roman +Copyright (c) 2015 IFTTT Inc +Copyright (c) 2015 David Román Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Popsicle.podspec b/Popsicle.podspec index b7cda7f..bc5731e 100755 --- a/Popsicle.podspec +++ b/Popsicle.podspec @@ -1,16 +1,17 @@ Pod::Spec.new do |s| s.name = "Popsicle" - s.version = "1.1.2" - s.summary = "Simple, extensible value interpolation framework" + s.version = "2.0.0" + s.summary = "Delightful, extensible Swift value interpolation framework" s.homepage = "https://github.com/DavdRoman/Popsicle" - s.author = { "David Roman" => "d@vidroman.me" } + s.author = { "David Román" => "d@vidroman.me" } s.license = { :type => 'MIT', :file => 'LICENSE' } + s.social_media_url = 'https://twitter.com/DavdRoman' - s.platform = :ios, '7.1' - s.ios.deployment_target = '7.1' + s.platform = :ios, '8.0' + s.ios.deployment_target = '8.0' s.source = { :git => "https://github.com/DavdRoman/Popsicle.git", :tag => s.version.to_s } - s.source_files = 'Popsicle/*.{h,m}' - s.frameworks = 'Foundation', 'UIKit' + s.source_files = 'Popsicle/*.{h,swift}' + s.frameworks = 'UIKit' s.requires_arc = true end diff --git a/Popsicle.xcodeproj/project.pbxproj b/Popsicle.xcodeproj/project.pbxproj index 5b1d30b..d918be2 100644 --- a/Popsicle.xcodeproj/project.pbxproj +++ b/Popsicle.xcodeproj/project.pbxproj @@ -7,74 +7,42 @@ objects = { /* Begin PBXBuildFile section */ - 759390AF1AF7CA44003427F2 /* Popsicle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 75CE051F1ACA133B008B893D /* Popsicle.framework */; }; - 759390C81AF7D129003427F2 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 759390C71AF7D129003427F2 /* Images.xcassets */; }; - 759390CB1AF7E31F003427F2 /* DRPageScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 759390CA1AF7E31F003427F2 /* DRPageScrollView.m */; }; - 75CE04F61ACA131B008B893D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 75CE04F51ACA131B008B893D /* main.m */; }; - 75CE04F91ACA131B008B893D /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 75CE04F81ACA131B008B893D /* AppDelegate.m */; }; - 75CE05071ACA131B008B893D /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 75CE05051ACA131B008B893D /* LaunchScreen.xib */; }; - 75CE05361ACA133B008B893D /* Popsicle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 75CE051F1ACA133B008B893D /* Popsicle.framework */; }; - 75CE05371ACA133B008B893D /* Popsicle.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 75CE051F1ACA133B008B893D /* Popsicle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 75CE05531ACA14C0008B893D /* Popsicle.h in Headers */ = {isa = PBXBuildFile; fileRef = 75CE053F1ACA14C0008B893D /* Popsicle.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 75CE05541ACA14C0008B893D /* PSInterpolator.h in Headers */ = {isa = PBXBuildFile; fileRef = 75CE05401ACA14C0008B893D /* PSInterpolator.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 75CE05551ACA14C0008B893D /* PSInterpolator.m in Sources */ = {isa = PBXBuildFile; fileRef = 75CE05411ACA14C0008B893D /* PSInterpolator.m */; }; - 75CE05561ACA14C0008B893D /* PSInterpolation.h in Headers */ = {isa = PBXBuildFile; fileRef = 75CE05421ACA14C0008B893D /* PSInterpolation.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 75CE05571ACA14C0008B893D /* PSInterpolation.m in Sources */ = {isa = PBXBuildFile; fileRef = 75CE05431ACA14C0008B893D /* PSInterpolation.m */; }; - 75CE05591ACA14C0008B893D /* PSIntegerInterpolation.h in Headers */ = {isa = PBXBuildFile; fileRef = 75CE05451ACA14C0008B893D /* PSIntegerInterpolation.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 75CE055A1ACA14C0008B893D /* PSIntegerInterpolation.m in Sources */ = {isa = PBXBuildFile; fileRef = 75CE05461ACA14C0008B893D /* PSIntegerInterpolation.m */; }; - 75CE055B1ACA14C0008B893D /* PSFloatInterpolation.h in Headers */ = {isa = PBXBuildFile; fileRef = 75CE05471ACA14C0008B893D /* PSFloatInterpolation.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 75CE055C1ACA14C0008B893D /* PSFloatInterpolation.m in Sources */ = {isa = PBXBuildFile; fileRef = 75CE05481ACA14C0008B893D /* PSFloatInterpolation.m */; }; - 75DCA4AA1ACB6334000F3646 /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 75DCA4A91ACB6334000F3646 /* MainViewController.m */; }; - 75DE00D71AFEE83500BE40E0 /* PSInterpolationContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 75DE00D51AFEE83500BE40E0 /* PSInterpolationContext.h */; }; - 75DE00D81AFEE83500BE40E0 /* PSInterpolationContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 75DE00D61AFEE83500BE40E0 /* PSInterpolationContext.m */; }; - 75DEC8AC1B0395D0007BED6A /* PageViews.xib in Resources */ = {isa = PBXBuildFile; fileRef = 75DEC8AB1B0395D0007BED6A /* PageViews.xib */; }; - 75DFE0DB1AFBF24500090283 /* PSInterpolation+Subclass.h in Headers */ = {isa = PBXBuildFile; fileRef = 75DFE0DA1AFBF24500090283 /* PSInterpolation+Subclass.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 75DFE10E1AFD51B000090283 /* PSPointInterpolation.h in Headers */ = {isa = PBXBuildFile; fileRef = 75CE05491ACA14C0008B893D /* PSPointInterpolation.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 75DFE10F1AFD51B000090283 /* PSPointInterpolation.m in Sources */ = {isa = PBXBuildFile; fileRef = 75CE054A1ACA14C0008B893D /* PSPointInterpolation.m */; }; - 75DFE1101AFD51B000090283 /* PSSizeInterpolation.h in Headers */ = {isa = PBXBuildFile; fileRef = 75CE054B1ACA14C0008B893D /* PSSizeInterpolation.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 75DFE1111AFD51B000090283 /* PSSizeInterpolation.m in Sources */ = {isa = PBXBuildFile; fileRef = 75CE054C1ACA14C0008B893D /* PSSizeInterpolation.m */; }; - 75DFE1121AFD51B000090283 /* PSRectInterpolation.h in Headers */ = {isa = PBXBuildFile; fileRef = 75CE054D1ACA14C0008B893D /* PSRectInterpolation.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 75DFE1131AFD51B000090283 /* PSRectInterpolation.m in Sources */ = {isa = PBXBuildFile; fileRef = 75CE054E1ACA14C0008B893D /* PSRectInterpolation.m */; }; - 75DFE1141AFD51B000090283 /* PSAffineTransformInterpolation.h in Headers */ = {isa = PBXBuildFile; fileRef = 75CE054F1ACA14C0008B893D /* PSAffineTransformInterpolation.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 75DFE1151AFD51B000090283 /* PSAffineTransformInterpolation.m in Sources */ = {isa = PBXBuildFile; fileRef = 75CE05501ACA14C0008B893D /* PSAffineTransformInterpolation.m */; }; - 75DFE1161AFD51B000090283 /* PSColorInterpolation.h in Headers */ = {isa = PBXBuildFile; fileRef = 75CE05511ACA14C0008B893D /* PSColorInterpolation.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 75DFE1171AFD51B000090283 /* PSColorInterpolation.m in Sources */ = {isa = PBXBuildFile; fileRef = 75CE05521ACA14C0008B893D /* PSColorInterpolation.m */; }; - 75DFE1191AFD51B500090283 /* PSInterpolationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 759390BB1AF7CA70003427F2 /* PSInterpolationTests.m */; }; - 75DFE11A1AFD51B500090283 /* PSIntegerInterpolationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 759390BD1AF7CA70003427F2 /* PSIntegerInterpolationTests.m */; }; - 75DFE11B1AFD51B500090283 /* PSFloatInterpolationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 759390B71AF7CA70003427F2 /* PSFloatInterpolationTests.m */; }; - 75DFE11C1AFD51B500090283 /* PSPointInterpolationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 759390B91AF7CA70003427F2 /* PSPointInterpolationTests.m */; }; - 75DFE11D1AFD51B500090283 /* PSSizeInterpolationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 759390B61AF7CA70003427F2 /* PSSizeInterpolationTests.m */; }; - 75DFE11E1AFD51B500090283 /* PSRectInterpolationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 759390B51AF7CA70003427F2 /* PSRectInterpolationTests.m */; }; - 75DFE1201AFD51B500090283 /* PSColorInterpolationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 759390B81AF7CA70003427F2 /* PSColorInterpolationTests.m */; }; - 75DFE1211AFD576A00090283 /* PSAffineTransformInterpolationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 759390BA1AF7CA70003427F2 /* PSAffineTransformInterpolationTests.m */; }; - 75DFE1241AFD6FED00090283 /* UIView+Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 75DFE1231AFD6FED00090283 /* UIView+Utils.m */; }; + D53B324C1BE65FF800A1820B /* Interpolable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D53B324B1BE65FF800A1820B /* Interpolable.swift */; }; + D53E5FD91BEA12340043DF84 /* EasingFunction.swift in Sources */ = {isa = PBXBuildFile; fileRef = D53E5FD81BEA12340043DF84 /* EasingFunction.swift */; }; + D53E5FDB1BEA13600043DF84 /* Interpolation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D53E5FDA1BEA13600043DF84 /* Interpolation.swift */; }; + D53E5FDD1BEA13900043DF84 /* Interpolator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D53E5FDC1BEA13900043DF84 /* Interpolator.swift */; }; + D53E5FE51BEA145F0043DF84 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D53E5FE41BEA145F0043DF84 /* AppDelegate.swift */; }; + D53E5FE71BEA145F0043DF84 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D53E5FE61BEA145F0043DF84 /* ViewController.swift */; }; + D53E5FEC1BEA145F0043DF84 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D53E5FEB1BEA145F0043DF84 /* Assets.xcassets */; }; + D53E5FEF1BEA145F0043DF84 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D53E5FED1BEA145F0043DF84 /* LaunchScreen.storyboard */; }; + D53E5FF71BEA16D70043DF84 /* PageViews.xib in Resources */ = {isa = PBXBuildFile; fileRef = D53E5FF61BEA16D70043DF84 /* PageViews.xib */; }; + D53E60011BEA203B0043DF84 /* PageScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D53E5FFF1BEA199C0043DF84 /* PageScrollView.swift */; }; + D53E60021BEA227D0043DF84 /* DRPageScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = D53E5FFA1BEA18140043DF84 /* DRPageScrollView.m */; }; + D53E60051BEA67790043DF84 /* UIView+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = D53E60041BEA67790043DF84 /* UIView+Utils.swift */; }; + D593A8DD1BEA72E500AFA257 /* Popsicle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D5FBF53A1BE65BB500F3CB79 /* Popsicle.framework */; }; + D593A8DE1BEA72E500AFA257 /* Popsicle.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D5FBF53A1BE65BB500F3CB79 /* Popsicle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + D5D6A94C1BEBB85A008E414E /* KeyPath.swift in Sources */ = {isa = PBXBuildFile; fileRef = D593A8E41BEA88B600AFA257 /* KeyPath.swift */; }; + D5FBF53E1BE65BB500F3CB79 /* Popsicle.h in Headers */ = {isa = PBXBuildFile; fileRef = D5FBF53D1BE65BB500F3CB79 /* Popsicle.h */; settings = {ATTRIBUTES = (Public, ); }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 759390B01AF7CA44003427F2 /* PBXContainerItemProxy */ = { + D593A8DF1BEA72E500AFA257 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 75CE04E61ACA130A008B893D /* Project object */; + containerPortal = D5FBF5311BE65BB500F3CB79 /* Project object */; proxyType = 1; - remoteGlobalIDString = 75CE051E1ACA133B008B893D; - remoteInfo = Popsicle; - }; - 75CE05341ACA133B008B893D /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 75CE04E61ACA130A008B893D /* Project object */; - proxyType = 1; - remoteGlobalIDString = 75CE051E1ACA133B008B893D; + remoteGlobalIDString = D5FBF5391BE65BB500F3CB79; remoteInfo = Popsicle; }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ - 75CE053B1ACA133B008B893D /* Embed Frameworks */ = { + D593A8E11BEA72E500AFA257 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 10; files = ( - 75CE05371ACA133B008B893D /* Popsicle.framework in Embed Frameworks */, + D593A8DE1BEA72E500AFA257 /* Popsicle.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -82,74 +50,38 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 759390A91AF7CA44003427F2 /* PopsicleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PopsicleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 759390AC1AF7CA44003427F2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 759390B51AF7CA70003427F2 /* PSRectInterpolationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSRectInterpolationTests.m; sourceTree = ""; }; - 759390B61AF7CA70003427F2 /* PSSizeInterpolationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSSizeInterpolationTests.m; sourceTree = ""; }; - 759390B71AF7CA70003427F2 /* PSFloatInterpolationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSFloatInterpolationTests.m; sourceTree = ""; }; - 759390B81AF7CA70003427F2 /* PSColorInterpolationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSColorInterpolationTests.m; sourceTree = ""; }; - 759390B91AF7CA70003427F2 /* PSPointInterpolationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSPointInterpolationTests.m; sourceTree = ""; }; - 759390BA1AF7CA70003427F2 /* PSAffineTransformInterpolationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSAffineTransformInterpolationTests.m; sourceTree = ""; }; - 759390BB1AF7CA70003427F2 /* PSInterpolationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSInterpolationTests.m; sourceTree = ""; }; - 759390BD1AF7CA70003427F2 /* PSIntegerInterpolationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSIntegerInterpolationTests.m; sourceTree = ""; }; - 759390C71AF7D129003427F2 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - 759390C91AF7E31F003427F2 /* DRPageScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DRPageScrollView.h; sourceTree = ""; }; - 759390CA1AF7E31F003427F2 /* DRPageScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DRPageScrollView.m; sourceTree = ""; }; - 75CE04F01ACA131B008B893D /* PopsicleDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PopsicleDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 75CE04F41ACA131B008B893D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 75CE04F51ACA131B008B893D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 75CE04F71ACA131B008B893D /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 75CE04F81ACA131B008B893D /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 75CE05061ACA131B008B893D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; - 75CE051F1ACA133B008B893D /* Popsicle.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Popsicle.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 75CE05221ACA133B008B893D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 75CE053F1ACA14C0008B893D /* Popsicle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Popsicle.h; sourceTree = ""; }; - 75CE05401ACA14C0008B893D /* PSInterpolator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSInterpolator.h; sourceTree = ""; }; - 75CE05411ACA14C0008B893D /* PSInterpolator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSInterpolator.m; sourceTree = ""; }; - 75CE05421ACA14C0008B893D /* PSInterpolation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSInterpolation.h; sourceTree = ""; }; - 75CE05431ACA14C0008B893D /* PSInterpolation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSInterpolation.m; sourceTree = ""; }; - 75CE05451ACA14C0008B893D /* PSIntegerInterpolation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSIntegerInterpolation.h; sourceTree = ""; }; - 75CE05461ACA14C0008B893D /* PSIntegerInterpolation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSIntegerInterpolation.m; sourceTree = ""; }; - 75CE05471ACA14C0008B893D /* PSFloatInterpolation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSFloatInterpolation.h; sourceTree = ""; }; - 75CE05481ACA14C0008B893D /* PSFloatInterpolation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSFloatInterpolation.m; sourceTree = ""; }; - 75CE05491ACA14C0008B893D /* PSPointInterpolation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSPointInterpolation.h; sourceTree = ""; }; - 75CE054A1ACA14C0008B893D /* PSPointInterpolation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSPointInterpolation.m; sourceTree = ""; }; - 75CE054B1ACA14C0008B893D /* PSSizeInterpolation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSSizeInterpolation.h; sourceTree = ""; }; - 75CE054C1ACA14C0008B893D /* PSSizeInterpolation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSSizeInterpolation.m; sourceTree = ""; }; - 75CE054D1ACA14C0008B893D /* PSRectInterpolation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSRectInterpolation.h; sourceTree = ""; }; - 75CE054E1ACA14C0008B893D /* PSRectInterpolation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSRectInterpolation.m; sourceTree = ""; }; - 75CE054F1ACA14C0008B893D /* PSAffineTransformInterpolation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSAffineTransformInterpolation.h; sourceTree = ""; }; - 75CE05501ACA14C0008B893D /* PSAffineTransformInterpolation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSAffineTransformInterpolation.m; sourceTree = ""; }; - 75CE05511ACA14C0008B893D /* PSColorInterpolation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSColorInterpolation.h; sourceTree = ""; }; - 75CE05521ACA14C0008B893D /* PSColorInterpolation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSColorInterpolation.m; sourceTree = ""; }; - 75DCA4A81ACB6334000F3646 /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = ""; }; - 75DCA4A91ACB6334000F3646 /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = ""; }; - 75DE00D51AFEE83500BE40E0 /* PSInterpolationContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSInterpolationContext.h; sourceTree = ""; }; - 75DE00D61AFEE83500BE40E0 /* PSInterpolationContext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSInterpolationContext.m; sourceTree = ""; }; - 75DEC8AB1B0395D0007BED6A /* PageViews.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PageViews.xib; sourceTree = ""; }; - 75DFE0DA1AFBF24500090283 /* PSInterpolation+Subclass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "PSInterpolation+Subclass.h"; sourceTree = ""; }; - 75DFE1221AFD6FED00090283 /* UIView+Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Utils.h"; sourceTree = ""; }; - 75DFE1231AFD6FED00090283 /* UIView+Utils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Utils.m"; sourceTree = ""; }; + D53B324B1BE65FF800A1820B /* Interpolable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Interpolable.swift; sourceTree = ""; }; + D53E5FD81BEA12340043DF84 /* EasingFunction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EasingFunction.swift; sourceTree = ""; }; + D53E5FDA1BEA13600043DF84 /* Interpolation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Interpolation.swift; sourceTree = ""; }; + D53E5FDC1BEA13900043DF84 /* Interpolator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Interpolator.swift; sourceTree = ""; }; + D53E5FE21BEA145F0043DF84 /* PopsicleDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PopsicleDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + D53E5FE41BEA145F0043DF84 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + D53E5FE61BEA145F0043DF84 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + D53E5FEB1BEA145F0043DF84 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + D53E5FEE1BEA145F0043DF84 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + D53E5FF01BEA145F0043DF84 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D53E5FF61BEA16D70043DF84 /* PageViews.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PageViews.xib; sourceTree = ""; }; + D53E5FF81BEA18130043DF84 /* PopsicleDemo-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "PopsicleDemo-Bridging-Header.h"; sourceTree = ""; }; + D53E5FF91BEA18140043DF84 /* DRPageScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DRPageScrollView.h; sourceTree = ""; }; + D53E5FFA1BEA18140043DF84 /* DRPageScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DRPageScrollView.m; sourceTree = ""; }; + D53E5FFF1BEA199C0043DF84 /* PageScrollView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PageScrollView.swift; sourceTree = ""; }; + D53E60041BEA67790043DF84 /* UIView+Utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Utils.swift"; sourceTree = ""; }; + D593A8E41BEA88B600AFA257 /* KeyPath.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyPath.swift; sourceTree = ""; }; + D5FBF53A1BE65BB500F3CB79 /* Popsicle.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Popsicle.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D5FBF53D1BE65BB500F3CB79 /* Popsicle.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Popsicle.h; sourceTree = ""; }; + D5FBF53F1BE65BB500F3CB79 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 759390A61AF7CA44003427F2 /* Frameworks */ = { + D53E5FDF1BEA145F0043DF84 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 759390AF1AF7CA44003427F2 /* Popsicle.framework in Frameworks */, + D593A8DD1BEA72E500AFA257 /* Popsicle.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 75CE04ED1ACA131B008B893D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 75CE05361ACA133B008B893D /* Popsicle.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 75CE051B1ACA133B008B893D /* Frameworks */ = { + D5FBF5361BE65BB500F3CB79 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( @@ -159,186 +91,105 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 759390AA1AF7CA44003427F2 /* PopsicleTests */ = { + D53E5FE31BEA145F0043DF84 /* PopsicleDemo */ = { isa = PBXGroup; children = ( - 759390BB1AF7CA70003427F2 /* PSInterpolationTests.m */, - 759390BD1AF7CA70003427F2 /* PSIntegerInterpolationTests.m */, - 759390B71AF7CA70003427F2 /* PSFloatInterpolationTests.m */, - 759390B91AF7CA70003427F2 /* PSPointInterpolationTests.m */, - 759390B61AF7CA70003427F2 /* PSSizeInterpolationTests.m */, - 759390B51AF7CA70003427F2 /* PSRectInterpolationTests.m */, - 759390BA1AF7CA70003427F2 /* PSAffineTransformInterpolationTests.m */, - 759390B81AF7CA70003427F2 /* PSColorInterpolationTests.m */, - 759390AB1AF7CA44003427F2 /* Supporting Files */, + D53E5FE41BEA145F0043DF84 /* AppDelegate.swift */, + D53E5FE61BEA145F0043DF84 /* ViewController.swift */, + D5F2E3E11BEB720B00008043 /* Page Scroll View */, + D53E5FEB1BEA145F0043DF84 /* Assets.xcassets */, + D53E5FED1BEA145F0043DF84 /* LaunchScreen.storyboard */, + D53E5FF01BEA145F0043DF84 /* Info.plist */, ); - path = PopsicleTests; + path = PopsicleDemo; sourceTree = ""; }; - 759390AB1AF7CA44003427F2 /* Supporting Files */ = { + D5F2E3E11BEB720B00008043 /* Page Scroll View */ = { isa = PBXGroup; children = ( - 759390AC1AF7CA44003427F2 /* Info.plist */, - ); - name = "Supporting Files"; + D53E5FF81BEA18130043DF84 /* PopsicleDemo-Bridging-Header.h */, + D53E5FF91BEA18140043DF84 /* DRPageScrollView.h */, + D53E5FFA1BEA18140043DF84 /* DRPageScrollView.m */, + D53E5FFF1BEA199C0043DF84 /* PageScrollView.swift */, + D53E5FF61BEA16D70043DF84 /* PageViews.xib */, + D53E60041BEA67790043DF84 /* UIView+Utils.swift */, + ); + name = "Page Scroll View"; sourceTree = ""; }; - 75CE04E51ACA130A008B893D = { + D5FBF5301BE65BB500F3CB79 = { isa = PBXGroup; children = ( - 75CE04F21ACA131B008B893D /* PopsicleDemo */, - 75CE05201ACA133B008B893D /* Popsicle */, - 759390AA1AF7CA44003427F2 /* PopsicleTests */, - 75CE04F11ACA131B008B893D /* Products */, + D53E5FE31BEA145F0043DF84 /* PopsicleDemo */, + D5FBF53C1BE65BB500F3CB79 /* Popsicle */, + D5FBF53B1BE65BB500F3CB79 /* Products */, ); sourceTree = ""; }; - 75CE04F11ACA131B008B893D /* Products */ = { + D5FBF53B1BE65BB500F3CB79 /* Products */ = { isa = PBXGroup; children = ( - 75CE04F01ACA131B008B893D /* PopsicleDemo.app */, - 75CE051F1ACA133B008B893D /* Popsicle.framework */, - 759390A91AF7CA44003427F2 /* PopsicleTests.xctest */, + D5FBF53A1BE65BB500F3CB79 /* Popsicle.framework */, + D53E5FE21BEA145F0043DF84 /* PopsicleDemo.app */, ); name = Products; sourceTree = ""; }; - 75CE04F21ACA131B008B893D /* PopsicleDemo */ = { + D5FBF53C1BE65BB500F3CB79 /* Popsicle */ = { isa = PBXGroup; children = ( - 75CE04F71ACA131B008B893D /* AppDelegate.h */, - 75CE04F81ACA131B008B893D /* AppDelegate.m */, - 75DCA4A81ACB6334000F3646 /* MainViewController.h */, - 75DCA4A91ACB6334000F3646 /* MainViewController.m */, - 759390C91AF7E31F003427F2 /* DRPageScrollView.h */, - 759390CA1AF7E31F003427F2 /* DRPageScrollView.m */, - 75DEC8AB1B0395D0007BED6A /* PageViews.xib */, - 75DFE1221AFD6FED00090283 /* UIView+Utils.h */, - 75DFE1231AFD6FED00090283 /* UIView+Utils.m */, - 75CE04F31ACA131B008B893D /* Supporting Files */, - ); - path = PopsicleDemo; - sourceTree = ""; - }; - 75CE04F31ACA131B008B893D /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 759390C71AF7D129003427F2 /* Images.xcassets */, - 75CE05051ACA131B008B893D /* LaunchScreen.xib */, - 75CE04F41ACA131B008B893D /* Info.plist */, - 75CE04F51ACA131B008B893D /* main.m */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 75CE05201ACA133B008B893D /* Popsicle */ = { - isa = PBXGroup; - children = ( - 75CE053F1ACA14C0008B893D /* Popsicle.h */, - 75CE05401ACA14C0008B893D /* PSInterpolator.h */, - 75CE05411ACA14C0008B893D /* PSInterpolator.m */, - 75DE00D51AFEE83500BE40E0 /* PSInterpolationContext.h */, - 75DE00D61AFEE83500BE40E0 /* PSInterpolationContext.m */, - 75CE05421ACA14C0008B893D /* PSInterpolation.h */, - 75CE05431ACA14C0008B893D /* PSInterpolation.m */, - 75DFE0DA1AFBF24500090283 /* PSInterpolation+Subclass.h */, - 75CE05451ACA14C0008B893D /* PSIntegerInterpolation.h */, - 75CE05461ACA14C0008B893D /* PSIntegerInterpolation.m */, - 75CE05471ACA14C0008B893D /* PSFloatInterpolation.h */, - 75CE05481ACA14C0008B893D /* PSFloatInterpolation.m */, - 75CE05491ACA14C0008B893D /* PSPointInterpolation.h */, - 75CE054A1ACA14C0008B893D /* PSPointInterpolation.m */, - 75CE054B1ACA14C0008B893D /* PSSizeInterpolation.h */, - 75CE054C1ACA14C0008B893D /* PSSizeInterpolation.m */, - 75CE054D1ACA14C0008B893D /* PSRectInterpolation.h */, - 75CE054E1ACA14C0008B893D /* PSRectInterpolation.m */, - 75CE054F1ACA14C0008B893D /* PSAffineTransformInterpolation.h */, - 75CE05501ACA14C0008B893D /* PSAffineTransformInterpolation.m */, - 75CE05511ACA14C0008B893D /* PSColorInterpolation.h */, - 75CE05521ACA14C0008B893D /* PSColorInterpolation.m */, - 75CE05211ACA133B008B893D /* Supporting Files */, + D5FBF53D1BE65BB500F3CB79 /* Popsicle.h */, + D53E5FDC1BEA13900043DF84 /* Interpolator.swift */, + D53E5FDA1BEA13600043DF84 /* Interpolation.swift */, + D53B324B1BE65FF800A1820B /* Interpolable.swift */, + D53E5FD81BEA12340043DF84 /* EasingFunction.swift */, + D593A8E41BEA88B600AFA257 /* KeyPath.swift */, + D5FBF53F1BE65BB500F3CB79 /* Info.plist */, ); path = Popsicle; sourceTree = ""; }; - 75CE05211ACA133B008B893D /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 75CE05221ACA133B008B893D /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ - 75CE051C1ACA133B008B893D /* Headers */ = { + D5FBF5371BE65BB500F3CB79 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 75DFE1141AFD51B000090283 /* PSAffineTransformInterpolation.h in Headers */, - 75DFE1121AFD51B000090283 /* PSRectInterpolation.h in Headers */, - 75CE05541ACA14C0008B893D /* PSInterpolator.h in Headers */, - 75DFE1161AFD51B000090283 /* PSColorInterpolation.h in Headers */, - 75DFE1101AFD51B000090283 /* PSSizeInterpolation.h in Headers */, - 75DFE10E1AFD51B000090283 /* PSPointInterpolation.h in Headers */, - 75DE00D71AFEE83500BE40E0 /* PSInterpolationContext.h in Headers */, - 75DFE0DB1AFBF24500090283 /* PSInterpolation+Subclass.h in Headers */, - 75CE055B1ACA14C0008B893D /* PSFloatInterpolation.h in Headers */, - 75CE05591ACA14C0008B893D /* PSIntegerInterpolation.h in Headers */, - 75CE05531ACA14C0008B893D /* Popsicle.h in Headers */, - 75CE05561ACA14C0008B893D /* PSInterpolation.h in Headers */, + D5FBF53E1BE65BB500F3CB79 /* Popsicle.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 759390A81AF7CA44003427F2 /* PopsicleTests */ = { + D53E5FE11BEA145F0043DF84 /* PopsicleDemo */ = { isa = PBXNativeTarget; - buildConfigurationList = 759390B21AF7CA44003427F2 /* Build configuration list for PBXNativeTarget "PopsicleTests" */; + buildConfigurationList = D53E5FF11BEA145F0043DF84 /* Build configuration list for PBXNativeTarget "PopsicleDemo" */; buildPhases = ( - 759390A51AF7CA44003427F2 /* Sources */, - 759390A61AF7CA44003427F2 /* Frameworks */, - 759390A71AF7CA44003427F2 /* Resources */, + D53E5FDE1BEA145F0043DF84 /* Sources */, + D53E5FDF1BEA145F0043DF84 /* Frameworks */, + D53E5FE01BEA145F0043DF84 /* Resources */, + D593A8E11BEA72E500AFA257 /* Embed Frameworks */, ); buildRules = ( ); dependencies = ( - 759390B11AF7CA44003427F2 /* PBXTargetDependency */, - ); - name = PopsicleTests; - productName = PopsicleTests; - productReference = 759390A91AF7CA44003427F2 /* PopsicleTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 75CE04EF1ACA131B008B893D /* PopsicleDemo */ = { - isa = PBXNativeTarget; - buildConfigurationList = 75CE05141ACA131B008B893D /* Build configuration list for PBXNativeTarget "PopsicleDemo" */; - buildPhases = ( - 75CE04EC1ACA131B008B893D /* Sources */, - 75CE04ED1ACA131B008B893D /* Frameworks */, - 75CE04EE1ACA131B008B893D /* Resources */, - 75CE053B1ACA133B008B893D /* Embed Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 75CE05351ACA133B008B893D /* PBXTargetDependency */, + D593A8E01BEA72E500AFA257 /* PBXTargetDependency */, ); name = PopsicleDemo; productName = PopsicleDemo; - productReference = 75CE04F01ACA131B008B893D /* PopsicleDemo.app */; + productReference = D53E5FE21BEA145F0043DF84 /* PopsicleDemo.app */; productType = "com.apple.product-type.application"; }; - 75CE051E1ACA133B008B893D /* Popsicle */ = { + D5FBF5391BE65BB500F3CB79 /* Popsicle */ = { isa = PBXNativeTarget; - buildConfigurationList = 75CE05381ACA133B008B893D /* Build configuration list for PBXNativeTarget "Popsicle" */; + buildConfigurationList = D5FBF54E1BE65BB600F3CB79 /* Build configuration list for PBXNativeTarget "Popsicle" */; buildPhases = ( - 75CE051A1ACA133B008B893D /* Sources */, - 75CE051B1ACA133B008B893D /* Frameworks */, - 75CE051C1ACA133B008B893D /* Headers */, - 75CE051D1ACA133B008B893D /* Resources */, + D5FBF5351BE65BB500F3CB79 /* Sources */, + D5FBF5361BE65BB500F3CB79 /* Frameworks */, + D5FBF5371BE65BB500F3CB79 /* Headers */, + D5FBF5381BE65BB500F3CB79 /* Resources */, ); buildRules = ( ); @@ -346,30 +197,28 @@ ); name = Popsicle; productName = Popsicle; - productReference = 75CE051F1ACA133B008B893D /* Popsicle.framework */; + productReference = D5FBF53A1BE65BB500F3CB79 /* Popsicle.framework */; productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ - 75CE04E61ACA130A008B893D /* Project object */ = { + D5FBF5311BE65BB500F3CB79 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0630; + LastSwiftUpdateCheck = 0710; + LastUpgradeCheck = 0710; + ORGANIZATIONNAME = "David Román Aguirre"; TargetAttributes = { - 759390A81AF7CA44003427F2 = { - CreatedOnToolsVersion = 6.3.1; + D53E5FE11BEA145F0043DF84 = { + CreatedOnToolsVersion = 7.1; }; - 75CE04EF1ACA131B008B893D = { - CreatedOnToolsVersion = 6.2; - DevelopmentTeam = 928NVD8D9L; - }; - 75CE051E1ACA133B008B893D = { - CreatedOnToolsVersion = 6.2; + D5FBF5391BE65BB500F3CB79 = { + CreatedOnToolsVersion = 7.1; }; }; }; - buildConfigurationList = 75CE04E91ACA130A008B893D /* Build configuration list for PBXProject "Popsicle" */; + buildConfigurationList = D5FBF5341BE65BB500F3CB79 /* Build configuration list for PBXProject "Popsicle" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; @@ -377,37 +226,29 @@ en, Base, ); - mainGroup = 75CE04E51ACA130A008B893D; - productRefGroup = 75CE04F11ACA131B008B893D /* Products */; + mainGroup = D5FBF5301BE65BB500F3CB79; + productRefGroup = D5FBF53B1BE65BB500F3CB79 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( - 75CE04EF1ACA131B008B893D /* PopsicleDemo */, - 75CE051E1ACA133B008B893D /* Popsicle */, - 759390A81AF7CA44003427F2 /* PopsicleTests */, + D53E5FE11BEA145F0043DF84 /* PopsicleDemo */, + D5FBF5391BE65BB500F3CB79 /* Popsicle */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - 759390A71AF7CA44003427F2 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 75CE04EE1ACA131B008B893D /* Resources */ = { + D53E5FE01BEA145F0043DF84 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 75CE05071ACA131B008B893D /* LaunchScreen.xib in Resources */, - 759390C81AF7D129003427F2 /* Images.xcassets in Resources */, - 75DEC8AC1B0395D0007BED6A /* PageViews.xib in Resources */, + D53E5FEF1BEA145F0043DF84 /* LaunchScreen.storyboard in Resources */, + D53E5FEC1BEA145F0043DF84 /* Assets.xcassets in Resources */, + D53E5FF71BEA16D70043DF84 /* PageViews.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 75CE051D1ACA133B008B893D /* Resources */ = { + D5FBF5381BE65BB500F3CB79 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( @@ -417,191 +258,85 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - 759390A51AF7CA44003427F2 /* Sources */ = { + D53E5FDE1BEA145F0043DF84 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 75DFE1201AFD51B500090283 /* PSColorInterpolationTests.m in Sources */, - 75DFE11A1AFD51B500090283 /* PSIntegerInterpolationTests.m in Sources */, - 75DFE11D1AFD51B500090283 /* PSSizeInterpolationTests.m in Sources */, - 75DFE1211AFD576A00090283 /* PSAffineTransformInterpolationTests.m in Sources */, - 75DFE11B1AFD51B500090283 /* PSFloatInterpolationTests.m in Sources */, - 75DFE1191AFD51B500090283 /* PSInterpolationTests.m in Sources */, - 75DFE11C1AFD51B500090283 /* PSPointInterpolationTests.m in Sources */, - 75DFE11E1AFD51B500090283 /* PSRectInterpolationTests.m in Sources */, + D53E5FE71BEA145F0043DF84 /* ViewController.swift in Sources */, + D53E5FE51BEA145F0043DF84 /* AppDelegate.swift in Sources */, + D53E60051BEA67790043DF84 /* UIView+Utils.swift in Sources */, + D53E60021BEA227D0043DF84 /* DRPageScrollView.m in Sources */, + D53E60011BEA203B0043DF84 /* PageScrollView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 75CE04EC1ACA131B008B893D /* Sources */ = { + D5FBF5351BE65BB500F3CB79 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 75CE04F91ACA131B008B893D /* AppDelegate.m in Sources */, - 75DCA4AA1ACB6334000F3646 /* MainViewController.m in Sources */, - 759390CB1AF7E31F003427F2 /* DRPageScrollView.m in Sources */, - 75DFE1241AFD6FED00090283 /* UIView+Utils.m in Sources */, - 75CE04F61ACA131B008B893D /* main.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 75CE051A1ACA133B008B893D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 75DFE1131AFD51B000090283 /* PSRectInterpolation.m in Sources */, - 75DE00D81AFEE83500BE40E0 /* PSInterpolationContext.m in Sources */, - 75CE05551ACA14C0008B893D /* PSInterpolator.m in Sources */, - 75DFE1171AFD51B000090283 /* PSColorInterpolation.m in Sources */, - 75CE05571ACA14C0008B893D /* PSInterpolation.m in Sources */, - 75DFE1111AFD51B000090283 /* PSSizeInterpolation.m in Sources */, - 75CE055C1ACA14C0008B893D /* PSFloatInterpolation.m in Sources */, - 75DFE10F1AFD51B000090283 /* PSPointInterpolation.m in Sources */, - 75DFE1151AFD51B000090283 /* PSAffineTransformInterpolation.m in Sources */, - 75CE055A1ACA14C0008B893D /* PSIntegerInterpolation.m in Sources */, + D53E5FDD1BEA13900043DF84 /* Interpolator.swift in Sources */, + D5D6A94C1BEBB85A008E414E /* KeyPath.swift in Sources */, + D53E5FD91BEA12340043DF84 /* EasingFunction.swift in Sources */, + D53B324C1BE65FF800A1820B /* Interpolable.swift in Sources */, + D53E5FDB1BEA13600043DF84 /* Interpolation.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 759390B11AF7CA44003427F2 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 75CE051E1ACA133B008B893D /* Popsicle */; - targetProxy = 759390B01AF7CA44003427F2 /* PBXContainerItemProxy */; - }; - 75CE05351ACA133B008B893D /* PBXTargetDependency */ = { + D593A8E01BEA72E500AFA257 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 75CE051E1ACA133B008B893D /* Popsicle */; - targetProxy = 75CE05341ACA133B008B893D /* PBXContainerItemProxy */; + target = D5FBF5391BE65BB500F3CB79 /* Popsicle */; + targetProxy = D593A8DF1BEA72E500AFA257 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ - 75CE05051ACA131B008B893D /* LaunchScreen.xib */ = { + D53E5FED1BEA145F0043DF84 /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; children = ( - 75CE05061ACA131B008B893D /* Base */, + D53E5FEE1BEA145F0043DF84 /* Base */, ); - name = LaunchScreen.xib; + name = LaunchScreen.storyboard; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ - 759390B31AF7CA44003427F2 /* Debug */ = { + D53E5FF21BEA145F0043DF84 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 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 = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - 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; - INFOPLIST_FILE = PopsicleTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.3; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; + EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; + INFOPLIST_FILE = PopsicleDemo/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = me.davidroman.PopsicleDemo; PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; + SWIFT_OBJC_BRIDGING_HEADER = "PopsicleDemo/PopsicleDemo-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; }; - 759390B41AF7CA44003427F2 /* Release */ = { + D53E5FF31BEA145F0043DF84 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 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 = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - 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; - INFOPLIST_FILE = PopsicleTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.3; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = NO; + EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; + INFOPLIST_FILE = PopsicleDemo/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = me.davidroman.PopsicleDemo; PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 75CE04EA1ACA130A008B893D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - ONLY_ACTIVE_ARCH = YES; - }; - name = Debug; - }; - 75CE04EB1ACA130A008B893D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + SWIFT_OBJC_BRIDGING_HEADER = "PopsicleDemo/PopsicleDemo-Bridging-Header.h"; }; name = Release; }; - 75CE05151ACA131B008B893D /* Debug */ = { + D5FBF54C1BE65BB600F3CB79 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -615,40 +350,41 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; 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; - INFOPLIST_FILE = PopsicleDemo/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; - PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; }; name = Debug; }; - 75CE05161ACA131B008B893D /* Release */ = { + D5FBF54D1BE65BB600F3CB79 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -662,171 +398,96 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; 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; - INFOPLIST_FILE = PopsicleDemo/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; }; name = Release; }; - 75CE05391ACA133B008B893D /* Debug */ = { + D5FBF54F1BE65BB600F3CB79 /* 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; - CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - 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; INFOPLIST_FILE = Popsicle/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = me.davidroman.Popsicle; PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; }; - 75CE053A1ACA133B008B893D /* Release */ = { + D5FBF5501BE65BB600F3CB79 /* 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; - CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - 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; INFOPLIST_FILE = Popsicle/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = me.davidroman.Popsicle; PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 759390B21AF7CA44003427F2 /* Build configuration list for PBXNativeTarget "PopsicleTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 759390B31AF7CA44003427F2 /* Debug */, - 759390B41AF7CA44003427F2 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 75CE04E91ACA130A008B893D /* Build configuration list for PBXProject "Popsicle" */ = { + D53E5FF11BEA145F0043DF84 /* Build configuration list for PBXNativeTarget "PopsicleDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( - 75CE04EA1ACA130A008B893D /* Debug */, - 75CE04EB1ACA130A008B893D /* Release */, + D53E5FF21BEA145F0043DF84 /* Debug */, + D53E5FF31BEA145F0043DF84 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 75CE05141ACA131B008B893D /* Build configuration list for PBXNativeTarget "PopsicleDemo" */ = { + D5FBF5341BE65BB500F3CB79 /* Build configuration list for PBXProject "Popsicle" */ = { isa = XCConfigurationList; buildConfigurations = ( - 75CE05151ACA131B008B893D /* Debug */, - 75CE05161ACA131B008B893D /* Release */, + D5FBF54C1BE65BB600F3CB79 /* Debug */, + D5FBF54D1BE65BB600F3CB79 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 75CE05381ACA133B008B893D /* Build configuration list for PBXNativeTarget "Popsicle" */ = { + D5FBF54E1BE65BB600F3CB79 /* Build configuration list for PBXNativeTarget "Popsicle" */ = { isa = XCConfigurationList; buildConfigurations = ( - 75CE05391ACA133B008B893D /* Debug */, - 75CE053A1ACA133B008B893D /* Release */, + D5FBF54F1BE65BB600F3CB79 /* Debug */, + D5FBF5501BE65BB600F3CB79 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; - rootObject = 75CE04E61ACA130A008B893D /* Project object */; + rootObject = D5FBF5311BE65BB500F3CB79 /* Project object */; } diff --git a/Popsicle.xcodeproj/xcshareddata/xcschemes/Popsicle.xcscheme b/Popsicle.xcodeproj/xcshareddata/xcschemes/Popsicle.xcscheme index 585a296..4795af9 100644 --- a/Popsicle.xcodeproj/xcshareddata/xcschemes/Popsicle.xcscheme +++ b/Popsicle.xcodeproj/xcshareddata/xcschemes/Popsicle.xcscheme @@ -1,6 +1,6 @@ @@ -23,35 +23,48 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> + + + + + + @@ -61,15 +74,15 @@ diff --git a/Popsicle/EasingFunction.swift b/Popsicle/EasingFunction.swift new file mode 100644 index 0000000..16d438a --- /dev/null +++ b/Popsicle/EasingFunction.swift @@ -0,0 +1,62 @@ +// +// EasingFunction.swift +// RazzleDazzle +// +// Created by Laura Skelton on 6/15/15. +// Copyright (c) 2015 IFTTT. All rights reserved. +// + +// Ported to Swift from Robert Böhnke's RBBAnimation, original available here: +// + +public typealias EasingFunction = (Progress) -> (Progress) + +public let EasingFunctionLinear: EasingFunction = { t in + return t +} + +public let EasingFunctionEaseInQuad: EasingFunction = { t in + return t * t +} + +public let EasingFunctionEaseOutQuad: EasingFunction = { t in + return t * (2 - t) +} + +public let EasingFunctionEaseInOutQuad: EasingFunction = { t in + if (t < 0.5) { return 2 * t * t } + return -1 + ((4 - (2 * t)) * t) +} + +public let EasingFunctionEaseInCubic: EasingFunction = { t in + return t * t * t +} + +public let EasingFunctionEaseOutCubic: EasingFunction = { t in + return pow(t - 1, 3) + 1 +} + +public let EasingFunctionEaseInOutCubic: EasingFunction = { t in + if (t < 0.5) { return 4 * pow(t, 3) } + return ((t - 1) * pow((2 * t) - 2, 2)) + 1 +} + +public let EasingFunctionEaseInBounce: EasingFunction = { t in + return 1 - EasingFunctionEaseOutBounce(1 - t) +} + +public let EasingFunctionEaseOutBounce: EasingFunction = { t in + if (t < (4.0 / 11.0)) { + return pow((11.0 / 4.0), 2) * pow(t, 2) + } + + if (t < (8.0 / 11.0)) { + return (3.0 / 4.0) + (pow((11.0 / 4.0), 2) * pow(t - (6.0 / 11.0), 2)) + } + + if (t < (10.0 / 11.0)) { + return (15.0 / 16.0) + (pow((11.0 / 4.0), 2) * pow(t - (9.0 / 11.0), 2)) + } + + return (63.0 / 64.0) + (pow((11.0 / 4.0), 2) * pow(t - (21.0 / 22.0), 2)) +} \ No newline at end of file diff --git a/Popsicle/Info.plist b/Popsicle/Info.plist index 3536789..7e7479f 100644 --- a/Popsicle/Info.plist +++ b/Popsicle/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - me.davidroman.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.1.0 + 2.0.0 CFBundleSignature ???? CFBundleVersion diff --git a/Popsicle/Interpolable.swift b/Popsicle/Interpolable.swift new file mode 100644 index 0000000..d231c00 --- /dev/null +++ b/Popsicle/Interpolable.swift @@ -0,0 +1,161 @@ +// +// Interpolable.swift +// Popsicle +// +// Created by David Román Aguirre on 01/11/15. +// Copyright © 2015 David Román Aguirre. All rights reserved. +// + +/// A value from 0 to 1 defining the progress of a certain interpolation between two `Interpolable` values. +public typealias Progress = Double + +/// Defines a common protocol for all interpolable values. +/// +/// Types conforming to this protocol are available to use as a `Interpolation` generic type. +public protocol Interpolable { + typealias ValueType + + /// Defines how an interpolation should be performed between two given values of the type conforming to this protocol. + static func interpolate(from fromValue: ValueType, to toValue: ValueType, withProgress: Progress) -> ValueType + + /// Converts a value to a valid `Foundation` object, if necessary. + static func objectify(value: ValueType) -> AnyObject +} + +extension Bool: Interpolable { + public static func interpolate(from fromValue: Bool, to toValue: Bool, withProgress progress: Progress) -> Bool { + return progress >= 0.5 ? toValue : fromValue + } + + public static func objectify(value: Bool) -> AnyObject { + return NSNumber(bool: value) + } +} + +extension CGFloat: Interpolable { + public static func interpolate(from fromValue: CGFloat, to toValue: CGFloat, withProgress progress: Progress) -> CGFloat { + return fromValue+(toValue-fromValue)*CGFloat(progress) + } + + public static func objectify(value: CGFloat) -> AnyObject { + return NSNumber(double: Double(value)) + } +} + +extension CGPoint: Interpolable { + public static func interpolate(from fromValue: CGPoint, to toValue: CGPoint, withProgress progress: Progress) -> CGPoint { + let x = CGFloat.interpolate(from: fromValue.x, to: toValue.x, withProgress: progress) + let y = CGFloat.interpolate(from: fromValue.y, to: toValue.y, withProgress: progress) + + return CGPointMake(x, y) + } + + public static func objectify(value: CGPoint) -> AnyObject { + return NSValue(CGPoint: value) + } +} + +extension CGSize: Interpolable { + public static func interpolate(from fromValue: CGSize, to toValue: CGSize, withProgress progress: Progress) -> CGSize { + let width = CGFloat.interpolate(from: fromValue.width, to: toValue.width, withProgress: progress) + let height = CGFloat.interpolate(from: fromValue.height, to: toValue.height, withProgress: progress) + + return CGSizeMake(width, height) + } + + public static func objectify(value: CGSize) -> AnyObject { + return NSValue(CGSize: value) + } +} + +extension CGRect: Interpolable { + public static func interpolate(from fromValue: CGRect, to toValue: CGRect, withProgress progress: Progress) -> CGRect { + let origin = CGPoint.interpolate(from: fromValue.origin, to: toValue.origin, withProgress: progress) + let size = CGSize.interpolate(from: fromValue.size, to: toValue.size, withProgress: progress) + + return CGRectMake(origin.x, origin.y, size.width, size.height) + } + + public static func objectify(value: CGRect) -> AnyObject { + return NSValue(CGRect: value) + } +} + +extension CGAffineTransform: Interpolable { + public static func interpolate(from fromValue: CGAffineTransform, to toValue: CGAffineTransform, withProgress progress: Progress) -> CGAffineTransform { + let tx1 = CGAffineTransformGetTranslationX(fromValue) + let tx2 = CGAffineTransformGetTranslationX(toValue) + let tx = CGFloat.interpolate(from: tx1, to: tx2, withProgress: progress) + + let ty1 = CGAffineTransformGetTranslationY(fromValue) + let ty2 = CGAffineTransformGetTranslationY(toValue) + let ty = CGFloat.interpolate(from: ty1, to: ty2, withProgress: progress) + + let sx1 = CGAffineTransformGetScaleX(fromValue) + let sx2 = CGAffineTransformGetScaleX(toValue) + let sx = CGFloat.interpolate(from: sx1, to: sx2, withProgress: progress) + + let sy1 = CGAffineTransformGetScaleY(fromValue) + let sy2 = CGAffineTransformGetScaleY(toValue) + let sy = CGFloat.interpolate(from: sy1, to: sy2, withProgress: progress) + + let deg1 = CGAffineTransformGetRotation(fromValue) + let deg2 = CGAffineTransformGetRotation(toValue) + let deg = CGFloat.interpolate(from: deg1, to: deg2, withProgress: progress) + + return CGAffineTransformMake(tx, ty, sx, sy, deg) + } + + public static func objectify(value: CGAffineTransform) -> AnyObject { + return NSValue(CGAffineTransform: value) + } +} + +/// `CGAffineTransformMake()`, The Right Way™ +/// +/// - parameter tx: translation on x axis. +/// - parameter ty: translation on y axis. +/// - parameter sx: scale factor for width. +/// - parameter sy: scale factor for height. +/// - parameter deg: degrees. +public func CGAffineTransformMake(tx: CGFloat, _ ty: CGFloat, _ sx: CGFloat, _ sy: CGFloat, _ deg: CGFloat) -> CGAffineTransform { + let translationTransform = CGAffineTransformMakeTranslation(tx, ty) + let scaleTransform = CGAffineTransformMakeScale(sx, sy) + let rotationTransform = CGAffineTransformMakeRotation(deg*CGFloat(M_PI_2)/180) + + return CGAffineTransformConcat(CGAffineTransformConcat(translationTransform, scaleTransform), rotationTransform) +} + +func CGAffineTransformGetTranslationX(t: CGAffineTransform) -> CGFloat { return t.tx } +func CGAffineTransformGetTranslationY(t: CGAffineTransform) -> CGFloat { return t.ty } +func CGAffineTransformGetScaleX(t: CGAffineTransform) -> CGFloat { return sqrt(t.a * t.a + t.c * t.c) } +func CGAffineTransformGetScaleY(t: CGAffineTransform) -> CGFloat { return sqrt(t.b * t.b + t.d * t.d) } +func CGAffineTransformGetRotation(t: CGAffineTransform) -> CGFloat { return (atan2(t.b, t.a)*180)/CGFloat(M_PI_2) } + +extension UIColor: Interpolable { + public static func interpolate(from fromValue: UIColor, to toValue: UIColor, withProgress progress: Progress) -> UIColor { + var fromRed: CGFloat = 0 + var fromGreen: CGFloat = 0 + var fromBlue: CGFloat = 0 + var fromAlpha: CGFloat = 0 + + var toRed: CGFloat = 0 + var toGreen: CGFloat = 0 + var toBlue: CGFloat = 0 + var toAlpha: CGFloat = 0 + + fromValue.getRed(&fromRed, green: &fromGreen, blue: &fromBlue, alpha: &fromAlpha) + toValue.getRed(&toRed, green: &toGreen, blue: &toBlue, alpha: &toAlpha) + + let red = CGFloat.interpolate(from: fromRed, to: toRed, withProgress: progress) + let green = CGFloat.interpolate(from: fromGreen, to: toGreen, withProgress: progress) + let blue = CGFloat.interpolate(from: fromBlue, to: toBlue, withProgress: progress) + let alpha = CGFloat.interpolate(from: fromAlpha, to: toAlpha, withProgress: progress) + + return UIColor(red: red, green: green, blue: blue, alpha: alpha) + } + + public static func objectify(value: UIColor) -> AnyObject { + return value + } +} \ No newline at end of file diff --git a/Popsicle/Interpolation.swift b/Popsicle/Interpolation.swift new file mode 100644 index 0000000..2e2de04 --- /dev/null +++ b/Popsicle/Interpolation.swift @@ -0,0 +1,134 @@ +// +// Interpolation.swift +// Popsicle +// +// Created by David Román Aguirre on 04/11/15. +// Copyright © 2015 David Román Aguirre. All rights reserved. +// + +protocol ObjectReferable { + var objectReference: NSObject { get } +} + +protocol Timeable { + func setTime(time: Time) +} + +/// `Interpolation` defines an interpolation which changes some `NSObject` value given by a key path. +public class Interpolation : Equatable, ObjectReferable, Timeable { + let object: NSObject + let keyPath: String + + let originalObject: NSObject + var objectReference: NSObject { return self.originalObject } + + typealias Pole = (T.ValueType, EasingFunction) + private var poles: [Time: Pole] = [:] + + public init(_ object: U, _ keyPath: KeyPath) { + self.originalObject = object + (self.object, self.keyPath) = NSObject.filteredObjectAndKeyPath(withObject: object, andKeyPath: keyPath) + + if !self.object.respondsToSelector(NSSelectorFromString(self.keyPath)) { + assertionFailure("Please make sure the key path \"" + self.keyPath + "\" you're referring to for an object of type <" + NSStringFromClass(self.object.dynamicType) + "> is invalid") + } + } + + /// A convenience initializer with `keyPath` as a `String` parameter. You should try to avoid this method unless absolutely necessary, due to its unsafety. + public convenience init(_ object: NSObject, _ keyPath: String) { + self.init(object, KeyPath(keyPathable: keyPath)) + } + + /// Sets a specific easing function for the interpolation to be performed with for a given time. + /// + /// - parameter easingFunction: the easing function to use. + /// - parameter time: the time where the easing function should be used. + public func setEasingFunction(easingFunction: EasingFunction, forTime time: Time) { + self.poles[time]?.1 = easingFunction + } + + public subscript(time1: Time, rest: Time...) -> T.ValueType? { + get { + assert(poles.count >= 2, "You must specify at least 2 poles for an interpolation to be performed") + if let existingPole = poles[time1] { + return existingPole.0 + } else if let timeInterval = poles.keys.sort().elementsAround(time1) { + + guard let fromTime = timeInterval.0 else { + return poles[timeInterval.1!]!.0 + } + + guard let toTime = timeInterval.1 else { + return poles[timeInterval.0!]!.0 + } + + let easingFunction = poles[fromTime]!.1 + let progress = easingFunction(self.progress(fromTime, toTime, time1)) + return T.interpolate(from: poles[fromTime]!.0, to: poles[toTime]!.0, withProgress: progress) + } + + return nil + } + + set { + var times = [time1] + times.appendContentsOf(rest) + for time in times { + poles[time] = (newValue!, EasingFunctionLinear) + } + } + } + + func progress(fromTime: Time, _ toTime: Time, _ currentTime: Time) -> Progress { + let p = (currentTime-fromTime)/(toTime-fromTime) + return min(1, max(0, p)) + } + + func setTime(time: Time) { + self.object.setValue(T.objectify(self[time]!), forKeyPath: self.keyPath) + } +} + +public func ==(lhs: Interpolation, rhs: Interpolation) -> Bool { + return lhs.object == rhs.object && lhs.keyPath == rhs.keyPath +} + +extension Array where Element: Comparable { + func elementPairs() -> [(Element, Element)]? { + if self.count >= 2 { + var elementPairs: [(Element, Element)] = [] + + for (i, e) in self.sort().enumerate() { + if i+1 < self.count { + elementPairs.append((e, self[i+1])) + } + } + + return elementPairs + } + + return nil + } + + func elementsAround(element: Element) -> (Element?, Element?)? { + if let pairs = self.elementPairs() { + + let minElement = pairs.first!.0 + let maxElement = pairs.last!.1 + + if element < minElement { + return (nil, minElement) + } + + if element > maxElement { + return (maxElement, nil) + } + + for (e1, e2) in pairs where (e1...e2).contains(element) { + return (e1, e2) + } + } + + return nil + } +} \ No newline at end of file diff --git a/Popsicle/Interpolator.swift b/Popsicle/Interpolator.swift new file mode 100644 index 0000000..b996c2c --- /dev/null +++ b/Popsicle/Interpolator.swift @@ -0,0 +1,56 @@ +// +// Interpolator.swift +// Popsicle +// +// Created by David Román Aguirre on 04/11/15. +// Copyright © 2015 David Román Aguirre. All rights reserved. +// + +/// Value type on which interpolation values rely on. +public typealias Time = Double + +/// `Interpolator` collects and coordinates a set of related interpolations through its `time` property. +public class Interpolator { + var interpolations = [Timeable]() + + public init() {} + + public func addInterpolation(interpolation: Interpolation) { + self.interpolations.append(interpolation) + } + + public var time: Time = 0 { + didSet { + for interpolation in self.interpolations { + interpolation.setTime(self.time) + } + } + } + + public func removeInterpolation(interpolation: Interpolation) { + for (index, element) in self.interpolations.enumerate() { + if let interpolation = element as? Interpolation { + if interpolation == interpolation { + self.interpolations.removeAtIndex(index) + } + } + } + } + + /// Removes all interpolations containing the specified object. + public func removeInterpolations(forObject object: NSObject) { + for (index, element) in self.interpolations.enumerate() { + if let interpolation = element as? ObjectReferable { + if interpolation.objectReference == object { + self.interpolations.removeAtIndex(index) + self.removeInterpolations(forObject: object) // Recursivity FTW + return + } + } + } + } + + public func removeAllInterpolations() { + self.interpolations.removeAll() + } +} \ No newline at end of file diff --git a/Popsicle/KeyPath.swift b/Popsicle/KeyPath.swift new file mode 100644 index 0000000..46ecbae --- /dev/null +++ b/Popsicle/KeyPath.swift @@ -0,0 +1,153 @@ +// +// KeyPath.swift +// Popsicle +// +// Created by David Román Aguirre on 04/11/15. +// Copyright © 2015 David Román Aguirre. All rights reserved. +// + +/// `KeyPathable` defines how a value is transformed to a valid `NSObject` key path. +public protocol KeyPathable { + func stringify() -> String +} + +extension String : KeyPathable { + public func stringify() -> String { + return self + } +} + +extension NSLayoutAttribute: KeyPathable { + public func stringify() -> String { + + var type = "UnknownAttribute" + + switch(self) { + case .Left: + type = "Left" + + case .Right: + type = "Right" + + case .Top: + type = "Top" + + case .Bottom: + type = "Bottom" + + case .Leading: + type = "Leading" + + case .Trailing: + type = "Trailing" + + case .Width: + type = "Width" + + case .Height: + type = "Height" + + case .CenterX: + type = "CenterX" + + case .CenterY: + type = "CenterY" + + case .Baseline: + type = "Baseline" + + case .FirstBaseline: + type = "FirstBaseline" + + case .LeftMargin: + type = "LeftMargin" + + case .RightMargin: + type = "RightMargin" + + case .TopMargin: + type = "TopMargin" + + case .BottomMargin: + type = "BottomMargin" + + case .LeadingMargin: + type = "LeadingMargin" + + case .TrailingMargin: + type = "TrailingMargin" + + case .CenterXWithinMargins: + type = "CenterXWithinMargins" + + case .CenterYWithinMargins: + type = "CenterYWithinMargins" + + case .NotAnAttribute: + type = "NotAnAttribute" + } + + return "NSLayoutAttribute." + type + } +} + +/// `KeyPath` defines a `NSObject`'s key path, constrained to specific `NSObject` and `Interpolable` types for higher safety. +public struct KeyPath { + let keyPathable: KeyPathable + + public init(keyPathable: KeyPathable) { + self.keyPathable = keyPathable + } +} + +public let alpha = KeyPath(keyPathable: "alpha") +public let backgroundColor = KeyPath(keyPathable: "backgroundColor") +public let barTintColor = KeyPath(keyPathable: "barTintColor") +public let borderColor = KeyPath(keyPathable: "borderColor") +public let borderWidth = KeyPath(keyPathable: "borderWidth") +public let constant = KeyPath(keyPathable: "constant") +public let cornerRadius = KeyPath(keyPathable: "cornerRadius") +public let hidden = KeyPath(keyPathable: "hidden") +public let textColor = KeyPath(keyPathable: "textColor") +public let tintColor = KeyPath(keyPathable: "tintColor") +public let transform = KeyPath(keyPathable: "transform") + +public let baselineConstraint = KeyPath(keyPathable: NSLayoutAttribute.Baseline) +public let firstBaselineConstraint = KeyPath(keyPathable: NSLayoutAttribute.FirstBaseline) + +public let topConstraint = KeyPath(keyPathable: NSLayoutAttribute.Top) +public let leftConstraint = KeyPath(keyPathable: NSLayoutAttribute.Left) +public let rightConstraint = KeyPath(keyPathable: NSLayoutAttribute.Right) +public let bottomConstraint = KeyPath(keyPathable: NSLayoutAttribute.Bottom) +public let leadingConstraint = KeyPath(keyPathable: NSLayoutAttribute.Leading) +public let trailingConstraint = KeyPath(keyPathable: NSLayoutAttribute.Trailing) + +public let leftMarginConstraint = KeyPath(keyPathable: NSLayoutAttribute.LeftMargin) +public let rightMarginConstraint = KeyPath(keyPathable: NSLayoutAttribute.RightMargin) +public let topMarginConstraint = KeyPath(keyPathable: NSLayoutAttribute.TopMargin) +public let bottomMarginConstraint = KeyPath(keyPathable: NSLayoutAttribute.BottomMargin) +public let leadingMarginConstraint = KeyPath(keyPathable: NSLayoutAttribute.LeadingMargin) +public let trailingMarginConstraint = KeyPath(keyPathable: NSLayoutAttribute.TrailingMargin) + +public let centerXConstraint = KeyPath(keyPathable: NSLayoutAttribute.CenterX) +public let centerYConstraint = KeyPath(keyPathable: NSLayoutAttribute.CenterY) + +public let centerXWithinMarginsConstraint = KeyPath(keyPathable: NSLayoutAttribute.CenterXWithinMargins) +public let centerYWithinMarginsConstraint = KeyPath(keyPathable: NSLayoutAttribute.CenterYWithinMargins) + +public let widthConstraint = KeyPath(keyPathable: NSLayoutAttribute.Width) +public let heightConstraint = KeyPath(keyPathable: NSLayoutAttribute.Height) + +extension NSObject { + static func filteredObjectAndKeyPath(withObject object: T, andKeyPath keyPath: KeyPath) -> (NSObject, String) { + if let view = object as? UIView, let superview = view.superview, let attribute = keyPath.keyPathable as? NSLayoutAttribute { + for constraint in superview.constraints where + (constraint.firstItem as? NSObject == view && constraint.firstAttribute == attribute) || + (constraint.secondItem as? NSObject == view && constraint.secondAttribute == attribute) { + return (constraint, constant.keyPathable.stringify()) + } + } + + return (object, keyPath.keyPathable.stringify()) + } +} \ No newline at end of file diff --git a/Popsicle/PSAffineTransformInterpolation.h b/Popsicle/PSAffineTransformInterpolation.h deleted file mode 100644 index c25c94f..0000000 --- a/Popsicle/PSAffineTransformInterpolation.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// PSAffineTransformInterpolation.h -// Popsicle -// -// Created by David Román Aguirre on 3/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import "PSInterpolation.h" -#import - -#define CGAffineTransformCreate(tx, ty, sx, sy, deg) CGAffineTransformRotate(CGAffineTransformConcat(CGAffineTransformMakeTranslation(tx, ty), CGAffineTransformMakeScale(sx, sy)), (deg*M_PI_2)/180) - -@interface PSAffineTransformInterpolation : PSInterpolation - -+ (instancetype)interpolationWithStartTime:(float)startTime endTime:(float)endTime fromValue:(CGAffineTransform)fromValue toValue:(CGAffineTransform)toValue; - -@end diff --git a/Popsicle/PSAffineTransformInterpolation.m b/Popsicle/PSAffineTransformInterpolation.m deleted file mode 100644 index ee0b6b3..0000000 --- a/Popsicle/PSAffineTransformInterpolation.m +++ /dev/null @@ -1,45 +0,0 @@ -// -// PSAffineTransformInterpolation.m -// Popsicle -// -// Created by David Román Aguirre on 3/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import "PSAffineTransformInterpolation.h" - -#import "PSInterpolation+Subclass.h" - -#define CGAffineTransformGetXTranslation(t) t.tx -#define CGAffineTransformGetYTranslation(t) t.ty -#define CGAffineTransformGetXScale(t) sqrt(t.a * t.a + t.c * t.c) -#define CGAffineTransformGetYScale(t) sqrt(t.b * t.b + t.d * t.d) -#define CGAffineTransformGetRotation(t) atan2f(t.b, t.a) - -@implementation PSAffineTransformInterpolation - -+ (instancetype)interpolationWithStartTime:(float)startTime endTime:(float)endTime fromValue:(CGAffineTransform)fromValue toValue:(CGAffineTransform)toValue { - return [super interpolationWithStartTime:startTime endTime:endTime fromValue:[NSValue valueWithCGAffineTransform:fromValue] toValue:[NSValue valueWithCGAffineTransform:toValue]]; -} - -- (id)valueForTimeFraction:(float)timeFraction { - CGAffineTransform fromValue = [self.fromValue CGAffineTransformValue]; - CGAffineTransform toValue = [self.toValue CGAffineTransformValue]; - - CGFloat xTranslationInterpolation = Interpolation(fromValue.tx, toValue.tx, timeFraction); - CGFloat yTranslationInterpolation = Interpolation(fromValue.ty, toValue.ty, timeFraction); - CGAffineTransform translationValue = CGAffineTransformMakeTranslation(xTranslationInterpolation, yTranslationInterpolation); - - CGFloat xScaleInterpolation = Interpolation(CGAffineTransformGetXScale(fromValue), CGAffineTransformGetXScale(toValue), timeFraction); - CGFloat yScaleInterpolation = Interpolation(CGAffineTransformGetYScale(fromValue), CGAffineTransformGetYScale(toValue), timeFraction); - CGAffineTransform scaleValue = CGAffineTransformMakeScale(xScaleInterpolation, yScaleInterpolation); - - CGFloat rotationInterpolation = Interpolation(CGAffineTransformGetRotation(fromValue), CGAffineTransformGetRotation(toValue), timeFraction); - CGAffineTransform rotationValue = CGAffineTransformMakeRotation(rotationInterpolation); - - CGAffineTransform value = CGAffineTransformConcat(CGAffineTransformConcat(translationValue, scaleValue), rotationValue); - - return [NSValue valueWithCGAffineTransform:value]; -} - -@end diff --git a/Popsicle/PSColorInterpolation.h b/Popsicle/PSColorInterpolation.h deleted file mode 100644 index 35306b5..0000000 --- a/Popsicle/PSColorInterpolation.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// PSColorInterpolation.h -// Popsicle -// -// Created by David Román Aguirre on 3/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import "PSInterpolation.h" -#import - -@interface PSColorInterpolation : PSInterpolation - -+ (instancetype)interpolationWithStartTime:(float)startTime endTime:(float)endTime fromValue:(UIColor *)fromValue toValue:(UIColor *)toValue; - -@end diff --git a/Popsicle/PSColorInterpolation.m b/Popsicle/PSColorInterpolation.m deleted file mode 100644 index 26046d7..0000000 --- a/Popsicle/PSColorInterpolation.m +++ /dev/null @@ -1,46 +0,0 @@ -// -// PSColorInterpolation.m -// Popsicle -// -// Created by David Román Aguirre on 3/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import "PSColorInterpolation.h" - -#import "PSInterpolation+Subclass.h" - -@implementation PSColorInterpolation - -+ (instancetype)interpolationWithStartTime:(float)startTime endTime:(float)endTime fromValue:(UIColor *)fromValue toValue:(UIColor *)toValue { - return [super interpolationWithStartTime:startTime endTime:endTime fromValue:fromValue toValue:toValue]; -} - -- (id)valueForTimeFraction:(float)timeFraction { - UIColor *fromValue = self.fromValue; - UIColor *toValue = self.toValue; - - CGFloat fromRed; - CGFloat fromGreen; - CGFloat fromBlue; - CGFloat fromAlpha; - - CGFloat toRed; - CGFloat toGreen; - CGFloat toBlue; - CGFloat toAlpha; - - [fromValue getRed:&fromRed green:&fromGreen blue:&fromBlue alpha:&fromAlpha]; - [toValue getRed:&toRed green:&toGreen blue:&toBlue alpha:&toAlpha]; - - CGFloat redInterpolation = Interpolation(fromRed, toRed, timeFraction); - CGFloat greenInterpolation = Interpolation(fromGreen, toGreen, timeFraction); - CGFloat blueInterpolation = Interpolation(fromBlue, toBlue, timeFraction); - CGFloat alphaInterpolation = Interpolation(fromAlpha, toAlpha, timeFraction); - - UIColor *value = [UIColor colorWithRed:redInterpolation green:greenInterpolation blue:blueInterpolation alpha:alphaInterpolation]; - - return value; -} - -@end diff --git a/Popsicle/PSFloatInterpolation.h b/Popsicle/PSFloatInterpolation.h deleted file mode 100644 index 2212579..0000000 --- a/Popsicle/PSFloatInterpolation.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// PSFloatInterpolation.h -// Popsicle -// -// Created by David Román Aguirre on 1/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import "PSInterpolation.h" - -@interface PSFloatInterpolation : PSInterpolation - -+ (instancetype)interpolationWithStartTime:(float)startTime endTime:(float)endTime fromValue:(float)fromValue toValue:(float)toValue; - -@end diff --git a/Popsicle/PSFloatInterpolation.m b/Popsicle/PSFloatInterpolation.m deleted file mode 100644 index 758a9ac..0000000 --- a/Popsicle/PSFloatInterpolation.m +++ /dev/null @@ -1,28 +0,0 @@ -// -// PSFloatInterpolation.m -// Popsicle -// -// Created by David Román Aguirre on 1/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import "PSFloatInterpolation.h" - -#import "PSInterpolation+Subclass.h" - -@implementation PSFloatInterpolation - -+ (instancetype)interpolationWithStartTime:(float)startTime endTime:(float)endTime fromValue:(float)fromValue toValue:(float)toValue { - return [super interpolationWithStartTime:startTime endTime:endTime fromValue:@(fromValue) toValue:@(toValue)]; -} - -- (id)valueForTimeFraction:(float)timeFraction { - float fromValue = [self.fromValue floatValue]; - float toValue = [self.toValue floatValue]; - - float value = Interpolation(fromValue, toValue, timeFraction); - - return @(value); -} - -@end diff --git a/Popsicle/PSIntegerInterpolation.h b/Popsicle/PSIntegerInterpolation.h deleted file mode 100644 index 933e099..0000000 --- a/Popsicle/PSIntegerInterpolation.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// PSIntegerInterpolation.h -// Popsicle -// -// Created by David Román Aguirre on 27/10/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import "PSInterpolation.h" - -@interface PSIntegerInterpolation : PSInterpolation - -+ (instancetype)interpolationWithStartTime:(float)startTime endTime:(float)endTime fromValue:(NSInteger)fromValue toValue:(NSInteger)toValue; - -@end diff --git a/Popsicle/PSIntegerInterpolation.m b/Popsicle/PSIntegerInterpolation.m deleted file mode 100644 index f1a8adf..0000000 --- a/Popsicle/PSIntegerInterpolation.m +++ /dev/null @@ -1,28 +0,0 @@ -// -// PSIntegerInterpolation.m -// Popsicle -// -// Created by David Román Aguirre on 27/10/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import "PSIntegerInterpolation.h" - -#import "PSInterpolation+Subclass.h" - -@implementation PSIntegerInterpolation - -+ (instancetype)interpolationWithStartTime:(float)startTime endTime:(float)endTime fromValue:(NSInteger)fromValue toValue:(NSInteger)toValue { - return [super interpolationWithStartTime:startTime endTime:endTime fromValue:@(fromValue) toValue:@(toValue)]; -} - -- (id)valueForTimeFraction:(float)timeFraction { - NSInteger fromValue = [self.fromValue integerValue]; - NSInteger toValue = [self.toValue integerValue]; - - NSInteger value = (NSInteger)floor(Interpolation(fromValue, toValue, timeFraction)); - - return @(value); -} - -@end diff --git a/Popsicle/PSInterpolation+Subclass.h b/Popsicle/PSInterpolation+Subclass.h deleted file mode 100644 index 39e8b3d..0000000 --- a/Popsicle/PSInterpolation+Subclass.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// PSInterpolation+Subclass.h -// Popsicle -// -// Created by David Román Aguirre on 1/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#define Interpolation(FROM_VALUE, TO_VALUE, TIME_FRACTION) (float)FROM_VALUE+((float)TO_VALUE-(float)FROM_VALUE)*(float)TIME_FRACTION - -@interface PSInterpolation () - -- (id)valueForTimeFraction:(float)timeFraction; - -@end diff --git a/Popsicle/PSInterpolation.h b/Popsicle/PSInterpolation.h deleted file mode 100644 index 023ff9e..0000000 --- a/Popsicle/PSInterpolation.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// PSInterpolation.h -// Popsicle -// -// Created by David Román Aguirre on 27/10/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import - -#define PS(INTERPOLATION_CLASS, START_TIME, END_TIME, FROM_VALUE, TO_VALUE) [INTERPOLATION_CLASS interpolationWithStartTime:START_TIME endTime:END_TIME fromValue:FROM_VALUE toValue:TO_VALUE] - -@interface PSInterpolation : NSObject - -@property (nonatomic) float startTime; -@property (nonatomic) float endTime; - -@property (nonatomic, strong) id fromValue; -@property (nonatomic, strong) id toValue; - -+ (instancetype)interpolationWithStartTime:(float)startTime endTime:(float)endTime fromValue:(id)fromValue toValue:(id)toValue; - -@end diff --git a/Popsicle/PSInterpolation.m b/Popsicle/PSInterpolation.m deleted file mode 100644 index d40c220..0000000 --- a/Popsicle/PSInterpolation.m +++ /dev/null @@ -1,29 +0,0 @@ -// -// PSInterpolation.m -// Popsicle -// -// Created by David Román Aguirre on 27/10/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import "PSInterpolation.h" - -@implementation PSInterpolation - -- (instancetype)initWithStartTime:(float)startTime endTime:(float)endTime fromValue:(id)fromValue toValue:(id)toValue { - if (self = [super init]) { - self.startTime = startTime; - self.endTime = endTime; - - self.fromValue = fromValue; - self.toValue = toValue; - } - - return self; -} - -+ (instancetype)interpolationWithStartTime:(float)startTime endTime:(float)endTime fromValue:(id)fromValue toValue:(id)toValue { - return [[self alloc] initWithStartTime:startTime endTime:endTime fromValue:fromValue toValue:toValue]; -} - -@end diff --git a/Popsicle/PSInterpolationContext.h b/Popsicle/PSInterpolationContext.h deleted file mode 100644 index 6d455b5..0000000 --- a/Popsicle/PSInterpolationContext.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// PSInterpolationContext.h -// Popsicle -// -// Created by David Román Aguirre on 10/5/15. -// Copyright (c) 2015 David Roman. All rights reserved. -// - -#import - -@class PSInterpolation; - -@interface PSInterpolationContext : NSObject - -@property (nonatomic, strong) PSInterpolation *interpolation; -@property (nonatomic, weak) id object; -@property (nonatomic, strong) NSString *keyPath; -@property (nonatomic) float timeFraction; - -+ (instancetype)contextWithInterpolation:(PSInterpolation *)interpolation object:(id)object keyPath:(NSString *)keyPath; - -@end diff --git a/Popsicle/PSInterpolationContext.m b/Popsicle/PSInterpolationContext.m deleted file mode 100644 index 71cc265..0000000 --- a/Popsicle/PSInterpolationContext.m +++ /dev/null @@ -1,27 +0,0 @@ -// -// PSInterpolationContext.m -// Popsicle -// -// Created by David Román Aguirre on 10/5/15. -// Copyright (c) 2015 David Roman. All rights reserved. -// - -#import "PSInterpolationContext.h" - -@implementation PSInterpolationContext - -- (instancetype)initWithWithInterpolation:(PSInterpolation *)interpolation object:(id)object keyPath:(NSString *)keyPath { - if (self = [super init]) { - self.interpolation = interpolation; - self.object = object; - self.keyPath = keyPath; - } - - return self; -} - -+ (instancetype)contextWithInterpolation:(PSInterpolation *)interpolation object:(id)object keyPath:(NSString *)keyPath { - return [[self alloc] initWithWithInterpolation:interpolation object:object keyPath:keyPath]; -} - -@end diff --git a/Popsicle/PSInterpolator.h b/Popsicle/PSInterpolator.h deleted file mode 100644 index 9a66cb8..0000000 --- a/Popsicle/PSInterpolator.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// PSInterpolator.h -// Popsicle -// -// Created by David Román Aguirre on 27/10/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import - -@interface PSInterpolator : NSObject - -@property (nonatomic, assign) float time; - -- (void)addInterpolations:(id)interpolations forObjects:(id)objects keyPath:(NSString *)keyPath; -- (void)removeAllInterpolations; - -@end diff --git a/Popsicle/PSInterpolator.m b/Popsicle/PSInterpolator.m deleted file mode 100644 index e78c710..0000000 --- a/Popsicle/PSInterpolator.m +++ /dev/null @@ -1,77 +0,0 @@ -// -// PSInterpolator.m -// Popsicle -// -// Created by David Román Aguirre on 27/10/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import "PSInterpolator.h" - -#import "PSInterpolation.h" -#import "PSInterpolationContext.h" -#import "PSInterpolation+Subclass.h" - -#define Fraction(START_VALUE, END_VALUE, VALUE) ((float)VALUE-(float)START_VALUE)/((float)END_VALUE-(float)START_VALUE) - -@interface PSInterpolator () - -@property (nonatomic, strong) NSMutableArray *interpolationContexts; - -@end - -@implementation PSInterpolator - -- (instancetype)init { - if (self = [super init]) { - self.interpolationContexts = [NSMutableArray new]; - } - - return self; -} - -- (void)performInterpolations { - for (PSInterpolationContext *ic in self.interpolationContexts) { - float timeFraction = Fraction(ic.interpolation.startTime, ic.interpolation.endTime, self.time); - timeFraction = MAX(0, timeFraction); - timeFraction = MIN(1, timeFraction); - - if (((ic.interpolation.endTime>ic.interpolation.startTime)?(ic.interpolation.startTime <= self.time && self.time <= ic.interpolation.endTime):(ic.interpolation.startTime >= self.time && self.time >= ic.interpolation.endTime)) || (ic.timeFraction != 1 && ic.timeFraction != 0)) { - id value = [ic.interpolation valueForTimeFraction:timeFraction]; - [ic.object setValue:value forKeyPath:ic.keyPath]; - ic.timeFraction = timeFraction; - } - } -} - -- (void)setTime:(float)time { - _time = time; - [self performInterpolations]; -} - -- (void)addInterpolations:(id)interpolations forObjects:(id)objects keyPath:(NSString *)keyPath { - safeFor(objects, ^void(id object) { - safeFor(interpolations, ^void(PSInterpolation *interpolation) { - interpolation.fromValue = interpolation.fromValue ? interpolation.fromValue : [object valueForKey:keyPath]; - - PSInterpolationContext *context = [PSInterpolationContext contextWithInterpolation:interpolation object:object keyPath:keyPath]; - [self.interpolationContexts addObject:context]; - }); - }); -} - -void safeFor(id arrayOrObject, void (^forBlock)(id object)) { - if ([arrayOrObject isKindOfClass:[NSArray class]]) { - for (id object in arrayOrObject) { - forBlock(object); - } - } else { - forBlock(arrayOrObject); - } -} - -- (void)removeAllInterpolations { - [self.interpolationContexts removeAllObjects]; -} - -@end diff --git a/Popsicle/PSPointInterpolation.h b/Popsicle/PSPointInterpolation.h deleted file mode 100644 index 88a8f05..0000000 --- a/Popsicle/PSPointInterpolation.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// PSPointInterpolation.h -// Popsicle -// -// Created by David Román Aguirre on 1/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import "PSInterpolation.h" -#import - -@interface PSPointInterpolation : PSInterpolation - -+ (instancetype)interpolationWithStartTime:(float)startTime endTime:(float)endTime fromValue:(CGPoint)fromValue toValue:(CGPoint)toValue; - -@end diff --git a/Popsicle/PSPointInterpolation.m b/Popsicle/PSPointInterpolation.m deleted file mode 100644 index cdee16d..0000000 --- a/Popsicle/PSPointInterpolation.m +++ /dev/null @@ -1,31 +0,0 @@ -// -// PSPointInterpolation.m -// Popsicle -// -// Created by David Román Aguirre on 1/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import "PSPointInterpolation.h" - -#import "PSInterpolation+Subclass.h" - -@implementation PSPointInterpolation - -+ (instancetype)interpolationWithStartTime:(float)startTime endTime:(float)endTime fromValue:(CGPoint)fromValue toValue:(CGPoint)toValue { - return [super interpolationWithStartTime:startTime endTime:endTime fromValue:[NSValue valueWithCGPoint:fromValue] toValue:[NSValue valueWithCGPoint:toValue]]; -} - -- (id)valueForTimeFraction:(float)timeFraction { - CGPoint fromValue = [self.fromValue CGPointValue]; - CGPoint toValue = [self.toValue CGPointValue]; - - CGFloat xInterpolation = Interpolation(fromValue.x, toValue.x, timeFraction); - CGFloat yInterpolation = Interpolation(fromValue.y, toValue.y, timeFraction); - - CGPoint value = CGPointMake(xInterpolation, yInterpolation); - - return [NSValue valueWithCGPoint:value]; -} - -@end diff --git a/Popsicle/PSRectInterpolation.h b/Popsicle/PSRectInterpolation.h deleted file mode 100644 index edf6780..0000000 --- a/Popsicle/PSRectInterpolation.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// PSRectInterpolation.h -// Popsicle -// -// Created by David Román Aguirre on 1/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import "PSInterpolation.h" -#import - -@interface PSRectInterpolation : PSInterpolation - -+ (instancetype)interpolationWithStartTime:(float)startTime endTime:(float)endTime fromValue:(CGRect)fromValue toValue:(CGRect)toValue; - -@end diff --git a/Popsicle/PSRectInterpolation.m b/Popsicle/PSRectInterpolation.m deleted file mode 100644 index 7d8be06..0000000 --- a/Popsicle/PSRectInterpolation.m +++ /dev/null @@ -1,33 +0,0 @@ -// -// PSRectInterpolation.m -// Popsicle -// -// Created by David Román Aguirre on 1/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import "PSRectInterpolation.h" - -#import "PSInterpolation+Subclass.h" - -@implementation PSRectInterpolation - -+ (instancetype)interpolationWithStartTime:(float)startTime endTime:(float)endTime fromValue:(CGRect)fromValue toValue:(CGRect)toValue { - return [super interpolationWithStartTime:startTime endTime:endTime fromValue:[NSValue valueWithCGRect:fromValue] toValue:[NSValue valueWithCGRect:toValue]]; -} - -- (id)valueForTimeFraction:(float)timeFraction { - CGRect fromValue = [self.fromValue CGRectValue]; - CGRect toValue = [self.toValue CGRectValue]; - - CGFloat xInterpolation = Interpolation(fromValue.origin.x, toValue.origin.x, timeFraction); - CGFloat yInterpolation = Interpolation(fromValue.origin.y, toValue.origin.y, timeFraction); - CGFloat widthInterpolation = Interpolation(fromValue.size.width, toValue.size.width, timeFraction); - CGFloat heightInterpolation = Interpolation(fromValue.size.height, toValue.size.height, timeFraction); - - CGRect value = CGRectMake(xInterpolation, yInterpolation, widthInterpolation, heightInterpolation); - - return [NSValue valueWithCGRect:value]; -} - -@end diff --git a/Popsicle/PSSizeInterpolation.h b/Popsicle/PSSizeInterpolation.h deleted file mode 100644 index e881c38..0000000 --- a/Popsicle/PSSizeInterpolation.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// PSSizeInterpolation.h -// Popsicle -// -// Created by David Román Aguirre on 1/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import "PSInterpolation.h" -#import - -@interface PSSizeInterpolation : PSInterpolation - -+ (instancetype)interpolationWithStartTime:(float)startTime endTime:(float)endTime fromValue:(CGSize)fromValue toValue:(CGSize)toValue; - -@end diff --git a/Popsicle/PSSizeInterpolation.m b/Popsicle/PSSizeInterpolation.m deleted file mode 100644 index 1889428..0000000 --- a/Popsicle/PSSizeInterpolation.m +++ /dev/null @@ -1,31 +0,0 @@ -// -// PSSizeInterpolation.m -// Popsicle -// -// Created by David Román Aguirre on 1/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import "PSSizeInterpolation.h" - -#import "PSInterpolation+Subclass.h" - -@implementation PSSizeInterpolation - -+ (instancetype)interpolationWithStartTime:(float)startTime endTime:(float)endTime fromValue:(CGSize)fromValue toValue:(CGSize)toValue { - return [super interpolationWithStartTime:startTime endTime:endTime fromValue:[NSValue valueWithCGSize:fromValue] toValue:[NSValue valueWithCGSize:toValue]]; -} - -- (id)valueForTimeFraction:(float)timeFraction { - CGSize fromValue = [self.fromValue CGSizeValue]; - CGSize toValue = [self.toValue CGSizeValue]; - - CGFloat widthInterpolation = Interpolation(fromValue.width, toValue.width, timeFraction); - CGFloat heightInterpolation = Interpolation(fromValue.height, toValue.height, timeFraction); - - CGSize value = CGSizeMake(widthInterpolation, heightInterpolation); - - return [NSValue valueWithCGSize:value]; -} - -@end diff --git a/Popsicle/Popsicle.h b/Popsicle/Popsicle.h index 1469d46..6627d4a 100644 --- a/Popsicle/Popsicle.h +++ b/Popsicle/Popsicle.h @@ -2,28 +2,16 @@ // Popsicle.h // Popsicle // -// Created by David Román Aguirre on 1/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. +// Created by David Román Aguirre on 01/11/15. +// Copyright © 2015 David Román Aguirre. All rights reserved. // -#import +@import UIKit; -//! Project version number for Bohr. +//! Project version number for Popsicle. FOUNDATION_EXPORT double PopsicleVersionNumber; -//! Project version string for Bohr. +//! Project version string for Popsicle. FOUNDATION_EXPORT const unsigned char PopsicleVersionString[]; -#import -#import -#import - -#import -#import - -#import -#import -#import -#import - -#import +// In this header, you should import all the public headers of your framework using statements like #import diff --git a/PopsicleDemo/AppDelegate.h b/PopsicleDemo/AppDelegate.h deleted file mode 100644 index cff3e42..0000000 --- a/PopsicleDemo/AppDelegate.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// AppDelegate.h -// PopsicleDemo -// -// Created by David Román Aguirre on 31/3/15. -// Copyright (c) 2015 David Roman. All rights reserved. -// - -#import - -@interface AppDelegate : UIResponder - -@property (nonatomic, strong) UIWindow *window; - -@end diff --git a/PopsicleDemo/AppDelegate.m b/PopsicleDemo/AppDelegate.m deleted file mode 100644 index 6ec499f..0000000 --- a/PopsicleDemo/AppDelegate.m +++ /dev/null @@ -1,23 +0,0 @@ -// -// AppDelegate.m -// PopsicleDemo -// -// Created by David Román Aguirre on 31/3/15. -// Copyright (c) 2015 David Roman. All rights reserved. -// - -#import "AppDelegate.h" -#import "MainViewController.h" - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - self.window.backgroundColor = [UIColor whiteColor]; - self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[MainViewController new]]; - [self.window makeKeyAndVisible]; - - return YES; -} - -@end diff --git a/PopsicleDemo/AppDelegate.swift b/PopsicleDemo/AppDelegate.swift new file mode 100644 index 0000000..c0b9385 --- /dev/null +++ b/PopsicleDemo/AppDelegate.swift @@ -0,0 +1,26 @@ +// +// AppDelegate.swift +// PopsicleDemo +// +// Created by David Román Aguirre on 04/11/15. +// Copyright © 2015 David Román Aguirre. All rights reserved. +// + +import UIKit + +@UIApplicationMain + +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { + + self.window = UIWindow(frame: UIScreen.mainScreen().bounds) + self.window?.rootViewController = UINavigationController(rootViewController: ViewController()) + self.window?.makeKeyAndVisible() + + return true + } +} + diff --git a/PopsicleDemo/Images.xcassets/AppIcon.appiconset/Contents.json b/PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 79% rename from PopsicleDemo/Images.xcassets/AppIcon.appiconset/Contents.json rename to PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Contents.json index 209a46b..c719e43 100644 --- a/PopsicleDemo/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -3,81 +3,78 @@ { "size" : "29x29", "idiom" : "iphone", - "filename" : "Icon-Small@3x.png", - "scale" : "3x", + "filename" : "Icon-Small@2x.png", + "scale" : "2x" }, { - "size" : "40x40", + "size" : "29x29", "idiom" : "iphone", - "filename" : "Icon-40@3x.png", - "scale" : "3x", + "filename" : "Icon-Small@3x.png", + "scale" : "3x" }, { - "size" : "60x60", + "size" : "40x40", "idiom" : "iphone", - "filename" : "Icon-60@3x.png", - "scale" : "3x", + "filename" : "Icon-40@2x.png", + "scale" : "2x" }, { "size" : "40x40", "idiom" : "iphone", - "filename" : "Icon-40@2x.png", - "scale" : "2x", + "filename" : "Icon-40@3x.png", + "scale" : "3x" }, { "size" : "60x60", "idiom" : "iphone", "filename" : "Icon-60@2x.png", - "scale" : "2x", + "scale" : "2x" }, { - "size" : "29x29", + "size" : "60x60", "idiom" : "iphone", - "filename" : "Icon-Small@2x.png", - "scale" : "2x", + "filename" : "Icon-60@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-Small~iPad.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-Small~iPad@2x.png", + "scale" : "2x" }, { "size" : "40x40", "idiom" : "ipad", "filename" : "Icon-40~iPad.png", - "scale" : "1x", + "scale" : "1x" }, { "size" : "40x40", "idiom" : "ipad", "filename" : "Icon-40~iPad@2x.png", - "scale" : "2x", + "scale" : "2x" }, { "size" : "76x76", "idiom" : "ipad", "filename" : "Icon-76.png", - "scale" : "1x", + "scale" : "1x" }, { "size" : "76x76", "idiom" : "ipad", "filename" : "Icon-76@2x.png", - "scale" : "2x", - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "Icon-Small~iPad.png", - "scale" : "1x", - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "Icon-Small~iPad@2x.png", - "scale" : "2x", - }, + "scale" : "2x" + } ], "info" : { "version" : 1, "author" : "xcode" - }, - "properties" : { - "pre-rendered" : false } } \ No newline at end of file diff --git a/PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png b/PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-40@2x.png similarity index 100% rename from PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png rename to PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-40@2x.png diff --git a/PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png b/PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-40@3x.png similarity index 100% rename from PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png rename to PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-40@3x.png diff --git a/PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-40~iPad.png b/PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-40~iPad.png similarity index 100% rename from PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-40~iPad.png rename to PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-40~iPad.png diff --git a/PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-40~iPad@2x.png b/PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-40~iPad@2x.png similarity index 100% rename from PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-40~iPad@2x.png rename to PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-40~iPad@2x.png diff --git a/PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png b/PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png similarity index 100% rename from PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png rename to PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png diff --git a/PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png b/PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png similarity index 100% rename from PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png rename to PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png diff --git a/PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-76.png b/PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-76.png similarity index 100% rename from PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-76.png rename to PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-76.png diff --git a/PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png b/PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png similarity index 100% rename from PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png rename to PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png diff --git a/PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png b/PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png similarity index 100% rename from PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png rename to PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png diff --git a/PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-Small@3x.png b/PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png similarity index 100% rename from PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-Small@3x.png rename to PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png diff --git a/PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-Small~iPad.png b/PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small~iPad.png similarity index 100% rename from PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-Small~iPad.png rename to PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small~iPad.png diff --git a/PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-Small~iPad@2x.png b/PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small~iPad@2x.png similarity index 100% rename from PopsicleDemo/Images.xcassets/AppIcon.appiconset/Icon-Small~iPad@2x.png rename to PopsicleDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small~iPad@2x.png diff --git a/PopsicleDemo/Assets.xcassets/Contents.json b/PopsicleDemo/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/PopsicleDemo/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/PopsicleDemo/Images.xcassets/logo.imageset/Contents.json b/PopsicleDemo/Assets.xcassets/logo.imageset/Contents.json similarity index 100% rename from PopsicleDemo/Images.xcassets/logo.imageset/Contents.json rename to PopsicleDemo/Assets.xcassets/logo.imageset/Contents.json diff --git a/PopsicleDemo/Images.xcassets/logo.imageset/logo.pdf b/PopsicleDemo/Assets.xcassets/logo.imageset/logo.pdf similarity index 100% rename from PopsicleDemo/Images.xcassets/logo.imageset/logo.pdf rename to PopsicleDemo/Assets.xcassets/logo.imageset/logo.pdf diff --git a/PopsicleDemo/Base.lproj/LaunchScreen.storyboard b/PopsicleDemo/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..1447b3c --- /dev/null +++ b/PopsicleDemo/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PopsicleDemo/Base.lproj/LaunchScreen.xib b/PopsicleDemo/Base.lproj/LaunchScreen.xib deleted file mode 100644 index 119062a..0000000 --- a/PopsicleDemo/Base.lproj/LaunchScreen.xib +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/PopsicleDemo/DRPageScrollView.m b/PopsicleDemo/DRPageScrollView.m index 9c91fac..fdfd583 100755 --- a/PopsicleDemo/DRPageScrollView.m +++ b/PopsicleDemo/DRPageScrollView.m @@ -22,18 +22,30 @@ @implementation DRPageScrollView - (instancetype)init { if (self = [super init]) { - previousPage = -1; - self.pagingEnabled = YES; - self.showsHorizontalScrollIndicator = NO; - self.showsVerticalScrollIndicator = NO; - - self.pageViews = [NSMutableArray new]; - self.pageHandlers = [NSArray new]; + [self commonInit]; } return self; } +- (instancetype)initWithFrame:(CGRect)frame { + if (self = [super initWithFrame:frame]) { + [self commonInit]; + } + + return self; +} + +- (void)commonInit { + previousPage = -1; + self.pagingEnabled = YES; + self.showsHorizontalScrollIndicator = NO; + self.showsVerticalScrollIndicator = NO; + + self.pageViews = [NSMutableArray new]; + self.pageHandlers = [NSArray new]; +} + - (void)setPageReuseEnabled:(BOOL)pageReuseEnabled { if (self.numberOfPages > 0) return; _pageReuseEnabled = pageReuseEnabled; diff --git a/PopsicleDemo/Info.plist b/PopsicleDemo/Info.plist index cc07e1d..f93ec29 100644 --- a/PopsicleDemo/Info.plist +++ b/PopsicleDemo/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - me.davidroman.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.1.0 + 2.0.0 CFBundleSignature ???? CFBundleVersion @@ -28,19 +28,11 @@ armv7 - UIStatusBarTintParameters - - UINavigationBar - - Style - UIBarStyleDefault - Translucent - - - UISupportedInterfaceOrientations UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight UISupportedInterfaceOrientations~ipad diff --git a/PopsicleDemo/MainViewController.h b/PopsicleDemo/MainViewController.h deleted file mode 100644 index db8a916..0000000 --- a/PopsicleDemo/MainViewController.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// MainViewController.h -// Popsicle -// -// Created by David Román Aguirre on 1/4/15. -// Copyright (c) 2015 David Roman. All rights reserved. -// - -#import - -@interface FirstPageView : UIView - -@property (weak, nonatomic) IBOutlet UILabel *label; -@property (weak, nonatomic) IBOutlet UIImageView *imageView; -@property (weak, nonatomic) IBOutlet NSLayoutConstraint *imageViewCenterYConstraint; -@property (weak, nonatomic) IBOutlet NSLayoutConstraint *imageViewCenterXConstraint; - -@end - -@interface SecondPageView : UIView - -@property (weak, nonatomic) IBOutlet UILabel *label; - -@end - -@interface ThirdPageView : UIView - -@property (weak, nonatomic) IBOutlet UILabel *label; - -@end - -@interface FourthPageView : UIView - -@property (weak, nonatomic) IBOutlet UILabel *label; - -@end - -@interface MainViewController : UIViewController - -@property (nonatomic, weak) FirstPageView *firstPageView; -@property (nonatomic, weak) SecondPageView *secondPageView; -@property (nonatomic, weak) ThirdPageView *thirdPageView; -@property (nonatomic, weak) FourthPageView *fourthPageView; - -@end diff --git a/PopsicleDemo/MainViewController.m b/PopsicleDemo/MainViewController.m deleted file mode 100644 index 5c46445..0000000 --- a/PopsicleDemo/MainViewController.m +++ /dev/null @@ -1,108 +0,0 @@ -// -// MainViewController.m -// Popsicle -// -// Created by David Román Aguirre on 1/4/15. -// Copyright (c) 2015 David Roman. All rights reserved. -// - -#import "MainViewController.h" - -#import "Popsicle.h" -#import "DRPageScrollView.h" -#import "UIView+Utils.h" - -@implementation FirstPageView @end -@implementation SecondPageView @end -@implementation ThirdPageView @end -@implementation FourthPageView @end - -@interface MainViewController () - -@property (nonatomic, strong) PSInterpolator *interpolator; -@property (nonatomic, strong) DRPageScrollView *pageScrollView; - -@end - -@implementation MainViewController - -- (id)init { - if (self = [super init]) { - self.interpolator = [PSInterpolator new]; - self.pageScrollView = [DRPageScrollView new]; - - NSDictionary *nibViews = [UIView nibViewsByClassWithNibName:@"PageViews"]; - self.firstPageView = nibViews[@"FirstPageView"]; - self.secondPageView = nibViews[@"SecondPageView"]; - self.thirdPageView = nibViews[@"ThirdPageView"]; - self.fourthPageView = nibViews[@"FourthPageView"]; - } - - return self; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - - self.title = @"Popsicle"; - self.view.backgroundColor = [UIColor whiteColor]; - - self.pageScrollView.delegate = self; - [self.view addSubview:self.pageScrollView]; - [self.pageScrollView pinToSuperviewEdges]; - [self addPageViews:@[self.firstPageView, self.secondPageView, self.thirdPageView, self.fourthPageView]]; -} - -- (void)addPageViews:(NSArray *)pageViews { - for (UIView *pv in pageViews) { - [self.pageScrollView addPageWithHandler:^(UIView *pageView) { - [pageView addSubview:pv]; - [pv pinToSuperviewEdges]; - }]; - } -} - -- (void)viewDidLayoutSubviews { - [super viewDidLayoutSubviews]; - - [self.interpolator removeAllInterpolations]; - - // Logo image view interpolations - - [self.interpolator addInterpolations:@[PS(PSFloatInterpolation, 0, 1, 0, -self.pageScrollView.width), - PS(PSFloatInterpolation, 1, 2, -self.pageScrollView.width, -self.pageScrollView.width*2), - PS(PSFloatInterpolation, 2, 3, -self.pageScrollView.width*2, -self.pageScrollView.width*3)] - forObjects:self.firstPageView.imageViewCenterXConstraint - keyPath:@"constant"]; - - [self.interpolator addInterpolations:@[PS(PSFloatInterpolation, 0, 1, 0, -self.pageScrollView.height/2+80), - PS(PSFloatInterpolation, 2, 3, -self.pageScrollView.height/2+80, 0)] - forObjects:self.firstPageView.imageViewCenterYConstraint - keyPath:@"constant"]; - - [self.interpolator addInterpolations:PS(PSFloatInterpolation, 2, 3, 1, 0.1) forObjects:self.firstPageView.imageView keyPath:@"alpha"]; - - [self.interpolator addInterpolations:PS(PSAffineTransformInterpolation, 2, 3, CGAffineTransformIdentity, CGAffineTransformCreate(0, 0, 1.4, 1.4, 60)) forObjects:self.firstPageView.imageView keyPath:@"transform"]; - - // First label interpolations - - [self.interpolator addInterpolations:PS(PSFloatInterpolation, 0, 0.4, 1, 0) forObjects:self.firstPageView.label keyPath:@"alpha"]; - - // Second label interpolations - - [self.interpolator addInterpolations:PS(PSFloatInterpolation, 1, 1.4, 1, 0) forObjects:self.secondPageView.label keyPath:@"alpha"]; - - // Third label interpolations - - [self.interpolator addInterpolations:PS(PSFloatInterpolation, 2, 2.4, 1, 0) forObjects:self.thirdPageView.label keyPath:@"alpha"]; - [self.interpolator addInterpolations:@[PS(PSAffineTransformInterpolation, 1, 2, CGAffineTransformCreate(0, 0, 0.5, 0.5, -70), CGAffineTransformIdentity), - PS(PSAffineTransformInterpolation, 2, 3, CGAffineTransformIdentity, CGAffineTransformCreate(0, 0, 0.5, 0.5, 0))] - forObjects:self.thirdPageView.label - keyPath:@"transform"]; -} - -- (void)scrollViewDidScroll:(UIScrollView *)scrollView { - self.interpolator.time = scrollView.contentOffset.x/scrollView.frame.size.width; // contentOffset.x/frame.size.width = current page index. -} - -@end diff --git a/PopsicleDemo/PageScrollView.swift b/PopsicleDemo/PageScrollView.swift new file mode 100644 index 0000000..a364143 --- /dev/null +++ b/PopsicleDemo/PageScrollView.swift @@ -0,0 +1,58 @@ +// +// PageScrollView.swift +// Popsicle +// +// Created by David Román Aguirre on 04/11/15. +// Copyright © 2015 David Román Aguirre. All rights reserved. +// + +import UIKit + +class FirstPageView: UIView { + @IBOutlet weak var label: UILabel? + @IBOutlet weak var imageView: UIImageView? +} + +class SecondPageView: UIView { + @IBOutlet weak var label: UILabel? +} + +class ThirdPageView: UIView { + @IBOutlet weak var label1: UILabel? + @IBOutlet weak var label2: UILabel? +} + +class FourthPageView: UIView { + @IBOutlet weak var label: UILabel? +} + +class PageScrollView: DRPageScrollView { + let firstPageView: FirstPageView + let secondPageView: SecondPageView + let thirdPageView: ThirdPageView + let fourthPageView: FourthPageView + + override init(frame: CGRect) { + let views = UIView.viewsByClassInNibNamed("PageViews") + self.firstPageView = views["PopsicleDemo.FirstPageView"] as! FirstPageView + self.secondPageView = views["PopsicleDemo.SecondPageView"] as! SecondPageView + self.thirdPageView = views["PopsicleDemo.ThirdPageView"] as! ThirdPageView + self.fourthPageView = views["PopsicleDemo.FourthPageView"] as! FourthPageView + super.init(frame: frame) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func didMoveToSuperview() { + if self.superview != nil { + for pv in [firstPageView, secondPageView, thirdPageView, fourthPageView] { + self.addPageWithHandler { pageView in + pageView.addSubview(pv) + pv.pinToSuperviewEdges() + } + } + } + } +} diff --git a/PopsicleDemo/PageViews.xib b/PopsicleDemo/PageViews.xib old mode 100644 new mode 100755 index 7707c5d..5ef952a --- a/PopsicleDemo/PageViews.xib +++ b/PopsicleDemo/PageViews.xib @@ -1,29 +1,34 @@ - + - + + + - + - + @@ -32,19 +37,19 @@ - - - + + - + + @@ -60,44 +66,67 @@ As you can see, Popsicle provides a great way to create transitions through valu - + - + + + - + + + + - + + - + - + @@ -106,7 +135,7 @@ For requests, comments or concerns, just open a GitHub issue or ping me @Dromagu - + diff --git a/PopsicleDemo/PopsicleDemo-Bridging-Header.h b/PopsicleDemo/PopsicleDemo-Bridging-Header.h new file mode 100644 index 0000000..99deb86 --- /dev/null +++ b/PopsicleDemo/PopsicleDemo-Bridging-Header.h @@ -0,0 +1,5 @@ +// +// Use this file to import your target's public headers that you would like to expose to Swift. +// + +#import "DRPageScrollView.h" \ No newline at end of file diff --git a/PopsicleDemo/UIView+Utils.h b/PopsicleDemo/UIView+Utils.h deleted file mode 100644 index b4bdc32..0000000 --- a/PopsicleDemo/UIView+Utils.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// UIView+Utils.h -// Popsicle -// -// Created by David Román Aguirre on 9/5/15. -// Copyright (c) 2015 David Roman. All rights reserved. -// - -#import - -@interface UIView (Utils) - -@property (nonatomic, assign) CGFloat x; -@property (nonatomic, assign) CGFloat y; -@property (nonatomic, assign) CGFloat width; -@property (nonatomic, assign) CGFloat height; - -- (void)pinToSuperviewEdges; - -+ (NSDictionary *)nibViewsByClassWithNibName:(NSString *)nibName; - -@end diff --git a/PopsicleDemo/UIView+Utils.m b/PopsicleDemo/UIView+Utils.m deleted file mode 100644 index e443d61..0000000 --- a/PopsicleDemo/UIView+Utils.m +++ /dev/null @@ -1,74 +0,0 @@ -// -// UIView+Utils.m -// Popsicle -// -// Created by David Román Aguirre on 9/5/15. -// Copyright (c) 2015 David Roman. All rights reserved. -// - -#import "UIView+Utils.h" - -@implementation UIView (Utils) - -#pragma mark Extended frame properties - -- (CGFloat)x { - return self.frame.origin.x; -} - -- (void)setX:(CGFloat)x { - self.frame = CGRectMake(x, self.frame.origin.y, self.frame.size.width, self.frame.size.height); -} - -- (CGFloat)y { - return self.frame.origin.y; -} - -- (void)setY:(CGFloat)y { - self.frame = CGRectMake(self.frame.origin.x, y, self.frame.size.width, self.frame.size.height); -} - -- (CGFloat)width { - return self.frame.size.width; -} - -- (void)setWidth:(CGFloat)width { - self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, width, self.frame.size.height); -} - -- (CGFloat)height { - return self.frame.size.height; -} - -- (void)setHeight:(CGFloat)height { - self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.frame.size.width, height); -} - -#pragma mark Helper methods - -- (void)pinToSuperviewEdges { - self.translatesAutoresizingMaskIntoConstraints = NO; - - NSArray *attributeArray = @[@(NSLayoutAttributeTop), @(NSLayoutAttributeLeft), @(NSLayoutAttributeBottom), @(NSLayoutAttributeRight)]; - - for (NSNumber *attributeNumber in attributeArray) { - NSLayoutAttribute attribute = (NSLayoutAttribute)[attributeNumber integerValue]; - - NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:self attribute:attribute relatedBy:NSLayoutRelationEqual toItem:self.superview attribute:attribute multiplier:1 constant:0]; - - [self.superview addConstraint:constraint]; - } -} - -+ (NSDictionary *)nibViewsByClassWithNibName:(NSString *)nibName { - NSMutableDictionary *nibViewsDictionary = [NSMutableDictionary new]; - NSArray *nibViewsArray = [[NSBundle mainBundle] loadNibNamed:nibName owner:self options:nil]; - - for (id nibView in nibViewsArray) { - [nibViewsDictionary setObject:nibView forKey:NSStringFromClass([nibView class])]; - } - - return nibViewsDictionary; -} - -@end diff --git a/PopsicleDemo/UIView+Utils.swift b/PopsicleDemo/UIView+Utils.swift new file mode 100644 index 0000000..3604871 --- /dev/null +++ b/PopsicleDemo/UIView+Utils.swift @@ -0,0 +1,33 @@ +// +// UIView+Utils.swift +// Popsicle +// +// Created by David Román Aguirre on 04/11/15. +// Copyright © 2015 David Román Aguirre. All rights reserved. +// + +extension UIView { + static func viewsByClassInNibNamed(name: String) -> [String: UIView] { + var viewsByClass = [String: UIView]() + + let nibViews = NSBundle.mainBundle().loadNibNamed(name, owner: self, options: nil) + + for view in nibViews { + if let v = view as? UIView { + viewsByClass[NSStringFromClass(v.dynamicType)] = v + } + } + + return viewsByClass + } + + func pinToSuperviewEdges() { + self.translatesAutoresizingMaskIntoConstraints = false + + for attribute in [.Top, .Left, .Bottom, .Right] as [NSLayoutAttribute] { + let constraint = NSLayoutConstraint(item: self, attribute: attribute, relatedBy: .Equal, toItem: self.superview, attribute: attribute, multiplier: 1, constant: 0) + + self.superview?.addConstraint(constraint) + } + } +} \ No newline at end of file diff --git a/PopsicleDemo/ViewController.swift b/PopsicleDemo/ViewController.swift new file mode 100644 index 0000000..6144d70 --- /dev/null +++ b/PopsicleDemo/ViewController.swift @@ -0,0 +1,118 @@ +// +// ViewController.swift +// PopsicleDemo +// +// Created by David Román Aguirre on 04/11/15. +// Copyright © 2015 David Román Aguirre. All rights reserved. +// + +import UIKit +import Popsicle + +class ViewController: UIViewController, UIScrollViewDelegate { + + let pageScrollView: PageScrollView + let interpolator: Interpolator + + init() { + self.pageScrollView = PageScrollView(frame: CGRectZero) + self.interpolator = Interpolator() + super.init(nibName: nil, bundle: nil) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func viewDidLoad() { + super.viewDidLoad() + + self.title = "Popsicle" + self.view.backgroundColor = UIColor.whiteColor() + + self.pageScrollView.delegate = self + self.view.addSubview(self.pageScrollView) + self.pageScrollView.pinToSuperviewEdges() + } + + override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + + self.interpolator.removeAllInterpolations() + + let backgroundColorInterpolation = Interpolation(self.view, backgroundColor) + backgroundColorInterpolation[1, 3] = UIColor.whiteColor() + backgroundColorInterpolation[1.7, 2] = UIColor(red: 254/255, green: 134/255, blue: 44/255, alpha: 1) + self.interpolator.addInterpolation(backgroundColorInterpolation) + + let barTintColorInterpolation = Interpolation(self.navigationController!.navigationBar, barTintColor) + barTintColorInterpolation[1, 3] = UIColor.whiteColor() + barTintColorInterpolation[1.7, 2] = UIColor(red: 244255, green: 219/255, blue: 165/255, alpha: 1) + self.interpolator.addInterpolation(barTintColorInterpolation) + + if let imageView = self.pageScrollView.firstPageView.imageView { + let xInterpolation = Interpolation(imageView, centerXConstraint) + xInterpolation[0] = 0 + xInterpolation.setEasingFunction(EasingFunctionEaseInQuad, forTime: 0) + xInterpolation[1] = -self.pageScrollView.frame.width + xInterpolation[2] = -self.pageScrollView.frame.width*2 + xInterpolation[3] = -self.pageScrollView.frame.width*3 + self.interpolator.addInterpolation(xInterpolation) + + let yInterpolation = Interpolation(imageView, centerYConstraint) + yInterpolation[0] = 0 + yInterpolation[1, 2] = -self.pageScrollView.frame.height/2+80 + yInterpolation[3] = 0 + self.interpolator.addInterpolation(yInterpolation) + + let alphaInterpolation = Interpolation(imageView, alpha) + alphaInterpolation[1] = 1 + alphaInterpolation[2] = 0 + alphaInterpolation[3] = 0.25 + self.interpolator.addInterpolation(alphaInterpolation) + + let transformInterpolation = Interpolation(imageView, transform) + transformInterpolation[0, 1, 2] = CGAffineTransformIdentity + transformInterpolation[0.25] = CGAffineTransformMake(0, 0, 1.1, 1.1, 0) + transformInterpolation[3] = CGAffineTransformMake(0, 0, 1.4, 1.4, 60) + self.interpolator.addInterpolation(transformInterpolation) + } + + if let label1 = self.pageScrollView.firstPageView.label { + let alphaInterpolation = Interpolation(label1, alpha) + alphaInterpolation[0] = 1 + alphaInterpolation[0.4] = 0 + self.interpolator.addInterpolation(alphaInterpolation) + } + + if let label2 = self.pageScrollView.secondPageView.label { + let scaleInterpolation = Interpolation(label2, transform) + scaleInterpolation[0] = CGAffineTransformMake(0, 0, 0.6, 0.6, 0) + scaleInterpolation[1] = CGAffineTransformMake(0, 0, 1, 1, 0) + self.interpolator.addInterpolation(scaleInterpolation) + + let alphaInterpolation = Interpolation(label2, alpha) + alphaInterpolation[1] = 1 + alphaInterpolation[1.7] = 0 + self.interpolator.addInterpolation(alphaInterpolation) + } + + if let label3 = self.pageScrollView.thirdPageView.label1, let label4 = self.pageScrollView.thirdPageView.label2 { + let translateInterpolation1 = Interpolation(label3, transform) + translateInterpolation1[1] = CGAffineTransformMake(100, 0, 1, 1, 0) + translateInterpolation1[2] = CGAffineTransformIdentity + translateInterpolation1[3] = CGAffineTransformMake(-100, 0, 1, 1, 0) + self.interpolator.addInterpolation(translateInterpolation1) + + let translateInterpolation2 = Interpolation(label4, transform) + translateInterpolation2[1] = CGAffineTransformMake(300, 0, 1, 1, 0) + translateInterpolation2[2] = CGAffineTransformIdentity + translateInterpolation2[3] = CGAffineTransformMake(-300, 0, 1, 1, 0) + self.interpolator.addInterpolation(translateInterpolation2) + } + } + + func scrollViewDidScroll(scrollView: UIScrollView) { + self.interpolator.time = Double(scrollView.contentOffset.x/scrollView.frame.size.width) + } +} \ No newline at end of file diff --git a/PopsicleDemo/main.m b/PopsicleDemo/main.m deleted file mode 100644 index 77598ab..0000000 --- a/PopsicleDemo/main.m +++ /dev/null @@ -1,16 +0,0 @@ -// -// main.m -// PopsicleDemo -// -// Created by David Román Aguirre on 31/3/15. -// -// - -#import -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/PopsicleTests/Info.plist b/PopsicleTests/Info.plist deleted file mode 100644 index bdb7eda..0000000 --- a/PopsicleTests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - me.davidroman.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/PopsicleTests/PSAffineTransformInterpolationTests.m b/PopsicleTests/PSAffineTransformInterpolationTests.m deleted file mode 100644 index 4433c8d..0000000 --- a/PopsicleTests/PSAffineTransformInterpolationTests.m +++ /dev/null @@ -1,49 +0,0 @@ -// -// PSAffineTransformInterpolationTests.m -// Popsicle -// -// Created by David Román Aguirre on 3/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import - -#import "PSAffineTransformInterpolation.h" -#import "PSInterpolation+Subclass.h" - -#define CGAffineTransformGetXTranslation(t) t.tx -#define CGAffineTransformGetYTranslation(t) t.ty -#define CGAffineTransformGetXScale(t) sqrt(t.a * t.a + t.c * t.c) -#define CGAffineTransformGetYScale(t) sqrt(t.b * t.b + t.d * t.d) -#define CGAffineTransformGetRotation(t) atan2f(t.b, t.a) - -@interface PSAffineTransformInterpolationTests : XCTestCase - -@end - -@implementation PSAffineTransformInterpolationTests - -- (void)testTranslationAffineTransformInterpolation { - PSAffineTransformInterpolation *interpolation = PS(PSAffineTransformInterpolation, 0, 100, CGAffineTransformIdentity, CGAffineTransformMakeTranslation(100, 100)); - - CGAffineTransform intermediateAffineTransform = [[interpolation valueForTimeFraction:0.5] CGAffineTransformValue]; - XCTAssertEqual(CGAffineTransformGetXTranslation(intermediateAffineTransform), 50); - XCTAssertEqual(CGAffineTransformGetYTranslation(intermediateAffineTransform), 50); -} - -- (void)testScaleAffineTransformInterpolation { - PSAffineTransformInterpolation *interpolation = PS(PSAffineTransformInterpolation, 0, 100, CGAffineTransformIdentity, CGAffineTransformMakeScale(1.5, 1.5)); - - CGAffineTransform intermediateAffineTransform = [[interpolation valueForTimeFraction:0.5] CGAffineTransformValue]; - XCTAssertEqual(CGAffineTransformGetXScale(intermediateAffineTransform), 1.25); - XCTAssertEqual(CGAffineTransformGetYScale(intermediateAffineTransform), 1.25); -} - -- (void)testRotationAffineTransformInterpolation { - PSAffineTransformInterpolation *interpolation = PS(PSAffineTransformInterpolation, 0, 100, CGAffineTransformIdentity, CGAffineTransformMakeRotation(0.5)); - - CGAffineTransform intermediateAffineTransform = [[interpolation valueForTimeFraction:0.5] CGAffineTransformValue]; - XCTAssertEqual(CGAffineTransformGetRotation(intermediateAffineTransform), 0.25); -} - -@end diff --git a/PopsicleTests/PSColorInterpolationTests.m b/PopsicleTests/PSColorInterpolationTests.m deleted file mode 100644 index 73e778b..0000000 --- a/PopsicleTests/PSColorInterpolationTests.m +++ /dev/null @@ -1,42 +0,0 @@ -// -// PSColorInterpolationTests.m -// Popsicle -// -// Created by David Román Aguirre on 4/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import - -#import "PSColorInterpolation.h" -#import "PSInterpolation+Subclass.h" - -@interface PSColorInterpolationTests : XCTestCase - -@end - -@implementation PSColorInterpolationTests - -- (void)testColorInterpolation { - PSColorInterpolation *interpolation = PS(PSColorInterpolation, 0, 100, [UIColor whiteColor], [UIColor blackColor]); - - CGFloat intermediateColorRedComponent; - CGFloat intermediateColorGreenComponent; - CGFloat intermediateColorBlueComponent; - CGFloat intermediateColorAlphaComponent; - - CGFloat grayColorRedComponent; - CGFloat grayColorGreenComponent; - CGFloat grayColorBlueComponent; - CGFloat grayColorAlphaComponent; - - [[interpolation valueForTimeFraction:0.5] getRed:&intermediateColorRedComponent green:&intermediateColorGreenComponent blue:&intermediateColorBlueComponent alpha:&intermediateColorAlphaComponent]; - [[UIColor grayColor] getRed:&grayColorRedComponent green:&grayColorGreenComponent blue:&grayColorBlueComponent alpha:&grayColorAlphaComponent]; - - XCTAssertEqual(intermediateColorRedComponent, grayColorRedComponent); - XCTAssertEqual(intermediateColorGreenComponent, grayColorGreenComponent); - XCTAssertEqual(intermediateColorBlueComponent, grayColorBlueComponent); - XCTAssertEqual(intermediateColorAlphaComponent, grayColorAlphaComponent); -} - -@end diff --git a/PopsicleTests/PSFloatInterpolationTests.m b/PopsicleTests/PSFloatInterpolationTests.m deleted file mode 100644 index 9a51859..0000000 --- a/PopsicleTests/PSFloatInterpolationTests.m +++ /dev/null @@ -1,29 +0,0 @@ -// -// PSFloatInterpolationTests.m -// Popsicle -// -// Created by David Román Aguirre on 1/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import - -#import "PSFloatInterpolation.h" -#import "PSInterpolation+Subclass.h" - -@interface PSFloatInterpolationTests : XCTestCase - -@end - -@implementation PSFloatInterpolationTests - -- (void)testFloatInterpolation { - PSFloatInterpolation *interpolation = PS(PSFloatInterpolation, 0, 30, 10, 20); - - XCTAssertEqualObjects([interpolation valueForTimeFraction:0], @10); - XCTAssertEqualObjects([interpolation valueForTimeFraction:0.5], @15); - XCTAssertEqual([[interpolation valueForTimeFraction:0.6916666] floatValue], 16.916666f); - XCTAssertEqualObjects([interpolation valueForTimeFraction:1], @20); -} - -@end diff --git a/PopsicleTests/PSIntegerInterpolationTests.m b/PopsicleTests/PSIntegerInterpolationTests.m deleted file mode 100644 index 9f8b349..0000000 --- a/PopsicleTests/PSIntegerInterpolationTests.m +++ /dev/null @@ -1,29 +0,0 @@ -// -// PSIntegerInterpolationTests.m -// Popsicle -// -// Created by David Román Aguirre on 1/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import - -#import "PSIntegerInterpolation.h" -#import "PSInterpolation+Subclass.h" - -@interface PSIntegerInterpolationTests : XCTestCase - -@end - -@implementation PSIntegerInterpolationTests - -- (void)testIntegerInterpolation { - PSIntegerInterpolation *interpolation = PS(PSIntegerInterpolation, 20, 30, 10, 20); - - XCTAssertEqualObjects([interpolation valueForTimeFraction:0], @10); - XCTAssertEqualObjects([interpolation valueForTimeFraction:0.5], @15); - XCTAssertEqualObjects([interpolation valueForTimeFraction:0.7], @17); - XCTAssertEqualObjects([interpolation valueForTimeFraction:1], @20); -} - -@end diff --git a/PopsicleTests/PSInterpolationTests.m b/PopsicleTests/PSInterpolationTests.m deleted file mode 100644 index a66c5ee..0000000 --- a/PopsicleTests/PSInterpolationTests.m +++ /dev/null @@ -1,33 +0,0 @@ -// -// PSInterpolationTests.m -// Popsicle -// -// Created by David Román Aguirre on 1/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import - -#import "PSInterpolation.h" -#import "PSInterpolation+Subclass.h" - -@interface PSInterpolationTests : XCTestCase - -@end - -@implementation PSInterpolationTests - -- (void)testInterpolation { - XCTAssertEqual(Interpolation(10, 20, 0.75), 17.5); -} - -- (void)testInitialization { - PSInterpolation *interpolation = PS(PSInterpolation, 20, 30, [NSObject new], [NSObject new]); - - XCTAssertEqual(interpolation.startTime, 20); - XCTAssertEqual(interpolation.endTime, 30); - XCTAssertNotNil(interpolation.fromValue); - XCTAssertNotNil(interpolation.toValue); -} - -@end diff --git a/PopsicleTests/PSPointInterpolationTests.m b/PopsicleTests/PSPointInterpolationTests.m deleted file mode 100644 index abe66e0..0000000 --- a/PopsicleTests/PSPointInterpolationTests.m +++ /dev/null @@ -1,33 +0,0 @@ -// -// PSPointInterpolationTests.m -// Popsicle -// -// Created by David Román Aguirre on 1/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import - -#import "PSPointInterpolation.h" -#import "PSInterpolation+Subclass.h" - -@interface PSPointInterpolationTests : XCTestCase - -@end - -@implementation PSPointInterpolationTests - -- (void)testPointInterpolation { - PSPointInterpolation *interpolation = PS(PSPointInterpolation, 0, 100, CGPointMake(30, 10), CGPointMake(90, 20)); - - XCTAssertEqual([[interpolation valueForTimeFraction:0] CGPointValue].x, 30); - XCTAssertEqual([[interpolation valueForTimeFraction:0] CGPointValue].y, 10); - - XCTAssertEqual([[interpolation valueForTimeFraction:0.5] CGPointValue].x, 60); - XCTAssertEqual([[interpolation valueForTimeFraction:0.5] CGPointValue].y, 15); - - XCTAssertEqual([[interpolation valueForTimeFraction:1] CGPointValue].x, 90); - XCTAssertEqual([[interpolation valueForTimeFraction:1] CGPointValue].y, 20); -} - -@end diff --git a/PopsicleTests/PSRectInterpolationTests.m b/PopsicleTests/PSRectInterpolationTests.m deleted file mode 100644 index 7fbefe4..0000000 --- a/PopsicleTests/PSRectInterpolationTests.m +++ /dev/null @@ -1,39 +0,0 @@ -// -// PSRectInterpolationTests.m -// Popsicle -// -// Created by David Román Aguirre on 2/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import - -#import "PSRectInterpolation.h" -#import "PSInterpolation+Subclass.h" - -@interface PSRectInterpolationTests : XCTestCase - -@end - -@implementation PSRectInterpolationTests - -- (void)testRectInterpolation { - PSRectInterpolation *interpolation = PS(PSRectInterpolation, 0, 100, CGRectMake(30, 10, 200, 150), CGRectMake(90, 20, 100, 100)); - - XCTAssertEqual([[interpolation valueForTimeFraction:0] CGRectValue].origin.x, 30); - XCTAssertEqual([[interpolation valueForTimeFraction:0] CGRectValue].origin.y, 10); - XCTAssertEqual([[interpolation valueForTimeFraction:0] CGRectValue].size.width, 200); - XCTAssertEqual([[interpolation valueForTimeFraction:0] CGRectValue].size.height, 150); - - XCTAssertEqual([[interpolation valueForTimeFraction:0.5] CGRectValue].origin.x, 60); - XCTAssertEqual([[interpolation valueForTimeFraction:0.5] CGRectValue].origin.y, 15); - XCTAssertEqual([[interpolation valueForTimeFraction:0.5] CGRectValue].size.width, 150); - XCTAssertEqual([[interpolation valueForTimeFraction:0.5] CGRectValue].size.height, 125); - - XCTAssertEqual([[interpolation valueForTimeFraction:1] CGRectValue].origin.x, 90); - XCTAssertEqual([[interpolation valueForTimeFraction:1] CGRectValue].origin.y, 20); - XCTAssertEqual([[interpolation valueForTimeFraction:1] CGRectValue].size.width, 100); - XCTAssertEqual([[interpolation valueForTimeFraction:1] CGRectValue].size.height, 100); -} - -@end diff --git a/PopsicleTests/PSSizeInterpolationTests.m b/PopsicleTests/PSSizeInterpolationTests.m deleted file mode 100644 index c04200a..0000000 --- a/PopsicleTests/PSSizeInterpolationTests.m +++ /dev/null @@ -1,33 +0,0 @@ -// -// PSSizeInterpolationTests.m -// Popsicle -// -// Created by David Román Aguirre on 2/11/14. -// Copyright (c) 2014 David Roman. All rights reserved. -// - -#import - -#import "PSSizeInterpolation.h" -#import "PSInterpolation+Subclass.h" - -@interface PSSizeInterpolationTests : XCTestCase - -@end - -@implementation PSSizeInterpolationTests - -- (void)testSizeInterpolation { - PSSizeInterpolation *interpolation = PS(PSSizeInterpolation, 0, 100, CGSizeMake(30, 10), CGSizeMake(90, 20)); - - XCTAssertEqual([[interpolation valueForTimeFraction:0] CGSizeValue].width, 30); - XCTAssertEqual([[interpolation valueForTimeFraction:0] CGSizeValue].height, 10); - - XCTAssertEqual([[interpolation valueForTimeFraction:0.5] CGSizeValue].width, 60); - XCTAssertEqual([[interpolation valueForTimeFraction:0.5] CGSizeValue].height, 15); - - XCTAssertEqual([[interpolation valueForTimeFraction:1] CGSizeValue].width, 90); - XCTAssertEqual([[interpolation valueForTimeFraction:1] CGSizeValue].height, 20); -} - -@end diff --git a/README.md b/README.md index b5ebad6..bc70bb7 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,18 @@

- Header + Popsicle header

-Popsicle is an easy-as-pie approach to creating and managing interpolations of different value types, as well as implementing your own custom value interpolations. +

+ Carthage compatible + CocoaPods compatible +

+ +Popsicle is a delightful solution for creating and managing interpolations of different value types with built-in UIKit support, written in Swift.

GIF 1

-_Note: this framework comes out as an abstraction of former `DRDynamicSlideShow`'s keyframing logic. You can combine this framework with components such as [__`DRPageScrollView`__](https://github.com/Dromaguirre/DRPageScrollView) or vanilla `UIScrollView` and still get the same functionality provided by `DRDynamicSlideShow`._ - ## Installation #### Carthage @@ -30,86 +33,60 @@ Drag and copy all files in the [__Popsicle__](Popsicle) folder into your project ## At a glance -#### Interpolating UIView values +#### Interpolating UIView (or any other NSObject) values -`Popsicle` is basically divided in two classes: `PSInterpolator` and `PSInterpolation`. +First, you need an `Interpolator` instance: -First, you need a retained instance of `PSInterpolator`, which is as simple as declaring it as a property or ivar (commonly in your view controller) and initializing it like this: - -```objective-c -interpolator = [PSInterpolator new]; +```swift +let interpolator = Interpolator() ``` -_Note: `interpolator` has a `time` property. Every `PSInterpolation` instance you add to that `PSInterpolator` instance will depend on that property to determine its current value. `time` is an abstract concept here, and has nothing to do with literal time. You may define `time` however you want. For example, `time` may be the position of a finger on the screen from 0 to 240, determined by a `UIPanGestureRecognizer`, or the amount of brightness of the screen from 0 to 1, determined by `UIScreen`._ - -Next, you need to add some `PSInterpolation` instances to your `interpolator`. In the example below, we are going to interpolate the alpha value of a UIView through a `PSFloatInterpolation`, with a `time` range of 0 to 100: +Next, you need to add some `Interpolation` instances to your interpolator. In the example below, we are going to interpolate the alpha value of a UIView for times between 0 and 150: -```objective-c -[self.interpolator addInterpolations:PS(PSFloatInterpolation, 0, 100, 1, 0) forObjects:view keyPath:@"alpha"]; +```swift +let interpolation = Interpolation(yourView, alpha) +interpolation[0] = 0 +interpolation[150] = 1 +self.interpolator.addInterpolation(interpolation) ``` -_Note: for the sake of simplicity, Popsicle provides a great macro to create instances of `PSInterpolation`: `PS(INTERPOLATION_CLASS, START_TIME, END_TIME, FROM_VALUE, TO_VALUE)`. Also note you can specify multiple interpolations for multiple objects at once._ +Note `alpha` is a built-in `KeyPath` constant. Popsicle offers a nice set of [__UIKit-related KeyPaths__](Popsicle/KeyPath.swift) ready to be used. You may also use a completely custom key path. -Finally, just make your `interpolator` vary its `time` depending on whatever you want. For example, in case you're using a `UIScrollView`: +You can also modify the easing function used at a given time: -```objective-c -- (void)scrollViewDidScroll:(UIScrollView *)scrollView { - interpolator.time = scrollView.contentOffset.x - // view.alpha = 1 when scrollView.contentOffset.x = 0 - // view.alpha = 0.75 when scrollView.contentOffset.x = 25 - // view.alpha = 0.5 when scrollView.contentOffset.x = 50 - // ... and so on. -} +```swift +interpolation.setEasingFunction(EasingFunctionEaseOutQuad, forTime: 0) ``` -#### Creating custom value interpolations - -You can create your own value interpolations subclassing `PSInterpolation`. +There's a bunch of [__built-in easing functions__](Popsicle/EasingFunction.swift) to choose from. -In the example below, you'll see how `PSFloatInterpolation` has been implemented. +Finally, just make your `interpolator` vary its `time` depending on whatever you want. For example, the content offset of a `UITableView`: -```objective-c -// PSFloatInterpolation.h - -#import "PSInterpolation.h" - -@interface PSFloatInterpolation : PSInterpolation - -// This allows PS() macro to work correctly. -+ (instancetype)interpolationWithStartTime:(float)startTime endTime:(float)endTime fromValue:(float)fromValue toValue:(float)toValue; - -@end +```swift +func scrollViewDidScroll(scrollView: UIScrollView) { + interpolator.time = Double(scrollView.contentOffset.y) +} ``` -```objective-c -// PSFloatInterpolation.h +#### Interpolating custom values -#import "PSFloatInterpolation.h" -#import "PSInterpolation+Subclass.h" // Notice you need this file for Interpolation() to work. +You can declare a value type as interpolable by making it conform to the `Interpolable` protocol. -@implementation PSFloatInterpolation +As an example, check out how `CGPoint` conforms to `Interpolable`: -// Remember fromValue and toValue are objects, so we need to pass in a NSNumber. You may make any necessary value conversions as shown below. -// If this library was written in Swift, this "problem" wouldn't exist, since values like float are already objects in Swift. Give me some time :) -+ (instancetype)interpolationWithStartTime:(float)startTime endTime:(float)endTime fromValue:(float)fromValue toValue:(float)toValue { - return [super interpolationWithStartTime:startTime endTime:endTime fromValue:@(fromValue) toValue:@(toValue)]; -} +```swift +extension CGSize: Interpolable { + public static func interpolate(from fromValue: CGSize, to toValue: CGSize, withProgress progress: Progress) -> CGSize { + let width = CGFloat.interpolate(from: fromValue.width, to: toValue.width, withProgress: progress) + let height = CGFloat.interpolate(from: fromValue.height, to: toValue.height, withProgress: progress) -// This method is called whenever PSInterpolator performs a new interpolation, so you must return a value here depending on timeFraction (from 0 to 1). -// The easiest way possible is using Interpolation(), already included in PSInterpolation+Subclass.h. -- (id)valueForTimeFraction:(float)timeFraction { - // Here we retrieve our fromValue and toValue and convert them to float in order to manage them with Interpolation(). - float fromValue = [self.fromValue floatValue]; - float toValue = [self.toValue floatValue]; - - // Here we interpolate fromValue and toValue depending on the parameter timeFraction in order to get the intermediate value we need to return. - float value = Interpolation(fromValue, toValue, timeFraction); - - // Here we retrieve our fromValue and toValue and convert them to float in order to manage them with Interpolation(). - return @(value); -} + return CGSizeMake(width, height) + } -@end + public static func objectify(value: CGSize) -> AnyObject { + return NSValue(CGSize: value) + } +} ``` ## License