diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..a3e71b8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,27 @@ + + +NOTE: ISSUES ARE NOT FOR CODE HELP - Ask for Help at https://stackoverflow.com + +Your issue may already be reported! +Please search on the [issue tracker](../) before creating one. + +#### Issue Description +* When Issue Happens +* Steps To Reproduce + +#### Environment Information +* Lib Version +* OS Version + +#### Your Code + +``` +If relevant, paste all of your challenge code in here +``` + +#### Screenshot \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..0c76a91 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,28 @@ + + +## Description + + +## Motivation and Context + + + +## How Has This Been Tested? + + + + +## Screenshots (if appropriate): + +## Types of changes + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) + +## Checklist: + + +- [ ] My code follows the code style of this project. +- [ ] My change requires a change to the documentation. +- [ ] I have updated the documentation accordingly. \ No newline at end of file diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 0000000..0915078 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,28 @@ +# Configuration for probot-stale - https://github.com/probot/stale + +# Number of days of inactivity before an Issue or Pull Request becomes stale +daysUntilStale: 60 + +# Number of days of inactivity before an Issue or Pull Request with the stale label is closed. +# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. +daysUntilClose: 7 + +# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled) +onlyLabels: [] + +# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable +exemptLabels: + - bug + - help wanted + - enhancement + - need review + - pinned + +# Label to use when marking as stale +staleLabel: stale + +# Comment to post when marking as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. diff --git a/.travis.yml b/.travis.yml index f371479..552c573 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c -osx_image: xcode9 +osx_image: xcode11.2 env: global: - FRAMEWORK_NAME=MXParallaxHeader @@ -8,9 +8,9 @@ before_install: - brew outdated carthage || brew upgrade carthage install: - gem install cocoapods -- gem install xcpretty --no-rdoc --no-ri --no-document --quiet +- gem install xcpretty --no-document --quiet script: -- set -o pipefail && xcodebuild -project MXParallaxHeader.xcodeproj -scheme $FRAMEWORK_NAME -sdk iphonesimulator11.0 -configuration Release | xcpretty -c +- set -o pipefail && xcodebuild -project MXParallaxHeader.xcodeproj -scheme $FRAMEWORK_NAME -sdk iphonesimulator13.2 -configuration Release | xcpretty -c - pod lib lint --quick before_deploy: - carthage build --no-skip-current diff --git a/Example-objc/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example-objc/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100755 index 1d060ed..0000000 --- a/Example-objc/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "3x" - }, - { - "idiom" : "ipad", - "size" : "20x20", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "20x20", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "29x29", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "40x40", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "76x76", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "76x76", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "83.5x83.5", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example-objc/Assets.xcassets/LaunchImage.launchimage/Contents.json b/Example-objc/Assets.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100755 index 4458b40..0000000 --- a/Example-objc/Assets.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "images" : [ - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "subtype" : "retina4", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} diff --git a/Example-objc/Base.lproj/Launch Screen.storyboard b/Example-objc/Base.lproj/Launch Screen.storyboard deleted file mode 100755 index aa96ecd..0000000 --- a/Example-objc/Base.lproj/Launch Screen.storyboard +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Example-objc/Base.lproj/Main.storyboard b/Example-objc/Base.lproj/Main.storyboard deleted file mode 100755 index b5ff5f2..0000000 --- a/Example-objc/Base.lproj/Main.storyboard +++ /dev/null @@ -1,274 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Example-objc/Info.plist b/Example-objc/Info.plist deleted file mode 100644 index 5e781b7..0000000 --- a/Example-objc/Info.plist +++ /dev/null @@ -1,38 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - Launch Screen - UIMainStoryboardFile - Main - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/Example-objc/MXAppDelegate.h b/Example-objc/MXAppDelegate.h deleted file mode 100755 index a59ebc2..0000000 --- a/Example-objc/MXAppDelegate.h +++ /dev/null @@ -1,29 +0,0 @@ -// MXAppDelegate.h -// -// Copyright (c) 2017 Maxime Epain -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -@import UIKit; - -@interface MXAppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/Example-objc/MXAppDelegate.m b/Example-objc/MXAppDelegate.m deleted file mode 100755 index 4d82ec7..0000000 --- a/Example-objc/MXAppDelegate.m +++ /dev/null @@ -1,62 +0,0 @@ -// MXAppDelegate.m -// -// Copyright (c) 2017 Maxime Epain -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import "MXAppDelegate.h" - -@implementation MXAppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - // Override point for customization after application launch. - [UITabBar appearance].tintColor = [UIColor colorWithRed:0.059 green:0.102 blue:0.216 alpha:1]; // #0F1A37 - - return YES; -} - -- (void)applicationWillResignActive:(UIApplication *)application -{ - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. -} - -- (void)applicationDidEnterBackground:(UIApplication *)application -{ - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. -} - -- (void)applicationWillEnterForeground:(UIApplication *)application -{ - // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. -} - -- (void)applicationDidBecomeActive:(UIApplication *)application -{ - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. -} - -- (void)applicationWillTerminate:(UIApplication *)application -{ - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. -} - -@end diff --git a/Example-objc/MXScrollView/MXScrollViewExample.h b/Example-objc/MXScrollView/MXScrollViewExample.h deleted file mode 100755 index 2333ea6..0000000 --- a/Example-objc/MXScrollView/MXScrollViewExample.h +++ /dev/null @@ -1,27 +0,0 @@ -// MXScrollViewExample.h -// -// Copyright (c) 2017 Maxime Epain -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -@import UIKit; - -@interface MXScrollViewExample : UIViewController - -@end diff --git a/Example-objc/MXScrollView/MXScrollViewExample.m b/Example-objc/MXScrollView/MXScrollViewExample.m deleted file mode 100755 index 377209b..0000000 --- a/Example-objc/MXScrollView/MXScrollViewExample.m +++ /dev/null @@ -1,128 +0,0 @@ -// MXScrollViewExample.m -// -// Copyright (c) 2017 Maxime Epain -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import -#import "MXScrollViewExample.h" - -#define SPANISH_WHITE [UIColor colorWithRed:0.996 green:0.992 blue:0.941 alpha:1] /*#fefdf0*/ - -@interface MXScrollViewExample () -@property (nonatomic, strong) MXScrollView *scrollView; -@property (nonatomic, strong) UITableView *table1; -@property (nonatomic, strong) UITableView *table2; -@end - -@implementation MXScrollViewExample - -- (void)viewDidLoad { - [super viewDidLoad]; - - [self.view addSubview:self.scrollView]; - [self.scrollView addSubview:self.table1]; - [self.scrollView addSubview:self.table2]; - - // Parallax Header - self.scrollView.parallaxHeader.view = [NSBundle.mainBundle loadNibNamed:@"StarshipHeader" owner:self options:nil].firstObject; // You can set the parallax header view from a nib. - self.scrollView.parallaxHeader.height = 300; - self.scrollView.parallaxHeader.mode = MXParallaxHeaderModeFill; - self.scrollView.parallaxHeader.minimumHeight = self.topLayoutGuide.length; -} - -- (void)viewDidAppear:(BOOL)animated { - [super viewDidAppear:animated]; - - self.scrollView.parallaxHeader.minimumHeight = self.topLayoutGuide.length; -} - -// In this example I use manual layout for peformances -- (void)viewDidLayoutSubviews { - [super viewDidLayoutSubviews]; - CGRect frame = self.view.frame; - - //Update scroll view frame and content size - self.scrollView.frame = frame; - self.scrollView.contentSize = frame.size; - - //Update table 1 frame - frame.size.width /= 2; - frame.size.height -= self.scrollView.parallaxHeader.minimumHeight; - self.table1.frame = frame; - - //Update table 2 frame - frame.origin.x = frame.size.width; - self.table2.frame = frame; -} - -#pragma mark Properties - -- (MXScrollView *)scrollView { - if(!_scrollView) { - _scrollView = [[MXScrollView alloc] init]; - _scrollView.delegate = self; - } - return _scrollView; -} - -- (UITableView *)table1 { - if (!_table1) { - _table1 = [[UITableView alloc] init]; - _table1.dataSource = self; - _table1.backgroundColor = SPANISH_WHITE; - } - return _table1; -} - -- (UITableView *)table2 { - if (!_table2) { - _table2 = [[UITableView alloc] init]; - _table2.dataSource = self; - _table2.backgroundColor = SPANISH_WHITE; - } - return _table2; -} - -#pragma mark - -- (void)scrollViewDidScroll:(UIScrollView *)scrollView { - NSLog(@"progress %f", self.scrollView.parallaxHeader.progress); -} - -#pragma mark - -- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return 50; -} - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *CellIdentifier = @"Cell"; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - if (cell == nil) { - cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; - } - cell.textLabel.text = [NSString stringWithFormat:@"Row %ld", (long)indexPath.row]; - cell.backgroundColor = SPANISH_WHITE; - - return cell; -} - -@end diff --git a/Example-objc/UIScrollView/StarshipHeader.xib b/Example-objc/UIScrollView/StarshipHeader.xib deleted file mode 100755 index a153b06..0000000 --- a/Example-objc/UIScrollView/StarshipHeader.xib +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Example-objc/UIScrollView/UIScrollViewExample.h b/Example-objc/UIScrollView/UIScrollViewExample.h deleted file mode 100755 index dab0f78..0000000 --- a/Example-objc/UIScrollView/UIScrollViewExample.h +++ /dev/null @@ -1,30 +0,0 @@ -// UIScrollViewExample.h -// -// Copyright (c) 2017 Maxime Epain -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -@import UIKit; - -@interface UIScrollViewExample : UITableViewController - -/// This Header view is a floating view from storyboard. -@property (strong, nonatomic) IBOutlet UIView *headerView; - -@end diff --git a/Example-objc/UIScrollView/UIScrollViewExample.m b/Example-objc/UIScrollView/UIScrollViewExample.m deleted file mode 100755 index 683706e..0000000 --- a/Example-objc/UIScrollView/UIScrollViewExample.m +++ /dev/null @@ -1,72 +0,0 @@ -// UIScrollViewExample.m -// -// Copyright (c) 2017 Maxime Epain -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import "UIScrollViewExample.h" -#import - -@interface UIScrollViewExample () - -@end - -@implementation UIScrollViewExample - -- (void)viewDidLoad { - [super viewDidLoad]; - - // Parallax Header - self.tableView.parallaxHeader.view = self.headerView; // You can set the parallax header view from the floating view. - self.tableView.parallaxHeader.height = 300; - self.tableView.parallaxHeader.mode = MXParallaxHeaderModeFill; - self.tableView.parallaxHeader.delegate = self; -} - -- (void)viewDidAppear:(BOOL)animated { - [super viewDidAppear:animated]; - - self.tableView.parallaxHeader.minimumHeight = self.topLayoutGuide.length; -} - -#pragma mark - -- (void)parallaxHeaderDidScroll:(MXParallaxHeader *)parallaxHeader { - NSLog(@"progress %f", parallaxHeader.progress); -} - -#pragma mark - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - self.tableView.parallaxHeader.height = indexPath.row * 10; -} - -#pragma mark - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return 50; -} - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"]; - cell.textLabel.text = [NSString stringWithFormat:@"Height %ld", (long)indexPath.row * 10]; - return cell; -} - -@end diff --git a/Example-objc/UIScrollViewController/MXFalconViewController.h b/Example-objc/UIScrollViewController/MXFalconViewController.h deleted file mode 100644 index 46725eb..0000000 --- a/Example-objc/UIScrollViewController/MXFalconViewController.h +++ /dev/null @@ -1,27 +0,0 @@ -// MXFalconViewController.h -// -// Copyright (c) 2017 Maxime Epain -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import - -@interface MXFalconViewController : UIViewController - -@end diff --git a/Example-objc/UIScrollViewController/MXFalconViewController.m b/Example-objc/UIScrollViewController/MXFalconViewController.m deleted file mode 100644 index 8aa4b67..0000000 --- a/Example-objc/UIScrollViewController/MXFalconViewController.m +++ /dev/null @@ -1,51 +0,0 @@ -// MXFalconViewController.m -// -// Copyright (c) 2017 Maxime Epain -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import "MXFalconViewController.h" - -#import - -@interface MXFalconViewController () -@property (weak, nonatomic) IBOutlet UIImageView *falcon; -@end - -@implementation MXFalconViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - - self.parallaxHeader.delegate = self; -} - -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - -#pragma mark - - -- (void)parallaxHeaderDidScroll:(MXParallaxHeader *)parallaxHeader { - CGFloat angle = parallaxHeader.progress * M_PI * 2; - self.falcon.transform = CGAffineTransformRotate(CGAffineTransformIdentity, angle); -} - -@end diff --git a/Example-objc/UIScrollViewController/MXWebViewController.h b/Example-objc/UIScrollViewController/MXWebViewController.h deleted file mode 100755 index fce5ceb..0000000 --- a/Example-objc/UIScrollViewController/MXWebViewController.h +++ /dev/null @@ -1,27 +0,0 @@ -// MXWebViewController.h -// -// Copyright (c) 2017 Maxime Epain -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import - -@interface MXWebViewController : UIViewController - -@end diff --git a/Example-objc/UIScrollViewController/MXWebViewController.m b/Example-objc/UIScrollViewController/MXWebViewController.m deleted file mode 100755 index 9103b8b..0000000 --- a/Example-objc/UIScrollViewController/MXWebViewController.m +++ /dev/null @@ -1,50 +0,0 @@ -// MXWebViewController.m -// -// Copyright (c) 2017 Maxime Epain -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import "MXWebViewController.h" - -@interface MXWebViewController () -@property (weak, nonatomic) IBOutlet UIWebView *webView; -@end - -@implementation MXWebViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - - NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://dribbble.com/search?q=spaceship"]]; - [self.webView loadRequest:request]; -} - -- (IBAction)back:(id)sender { - [self.webView goBack]; -} - -- (IBAction)forward:(id)sender { - [self.webView goForward]; -} - -- (IBAction)refresh:(id)sender { - [self.webView reload]; -} - -@end diff --git a/Example-objc/main.m b/Example-objc/main.m deleted file mode 100755 index be56e97..0000000 --- a/Example-objc/main.m +++ /dev/null @@ -1,17 +0,0 @@ -// -// main.m -// MXParallaxHeader -// -// Created by Maxime Epain on 10/28/2015. -// Copyright (c) 2017 Maxime Epain. All rights reserved. -// - -@import UIKit; -#import "MXAppDelegate.h" - -int main(int argc, char * argv[]) -{ - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([MXAppDelegate class])); - } -} diff --git a/Example-swift/Assets.xcassets/Background.imageset/Contents.json b/Example-swift/Assets.xcassets/Background.imageset/Contents.json deleted file mode 100644 index b0a729d..0000000 --- a/Example-swift/Assets.xcassets/Background.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "_111_background.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example-swift/Assets.xcassets/Background.imageset/_111_background.png b/Example-swift/Assets.xcassets/Background.imageset/_111_background.png deleted file mode 100644 index 5132d6c..0000000 Binary files a/Example-swift/Assets.xcassets/Background.imageset/_111_background.png and /dev/null differ diff --git a/Example-swift/Assets.xcassets/Background1.imageset/Contents.json b/Example-swift/Assets.xcassets/Background1.imageset/Contents.json deleted file mode 100644 index c9409d3..0000000 --- a/Example-swift/Assets.xcassets/Background1.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "stars.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example-swift/Assets.xcassets/Background1.imageset/stars.png b/Example-swift/Assets.xcassets/Background1.imageset/stars.png deleted file mode 100644 index 90e6c2d..0000000 Binary files a/Example-swift/Assets.xcassets/Background1.imageset/stars.png and /dev/null differ diff --git a/Example-swift/Assets.xcassets/Background2.imageset/Contents.json b/Example-swift/Assets.xcassets/Background2.imageset/Contents.json deleted file mode 100644 index c9409d3..0000000 --- a/Example-swift/Assets.xcassets/Background2.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "stars.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example-swift/Assets.xcassets/Background2.imageset/stars.png b/Example-swift/Assets.xcassets/Background2.imageset/stars.png deleted file mode 100644 index 6dab0b4..0000000 Binary files a/Example-swift/Assets.xcassets/Background2.imageset/stars.png and /dev/null differ diff --git a/Example-swift/Assets.xcassets/Contents.json b/Example-swift/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164..0000000 --- a/Example-swift/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example-swift/Assets.xcassets/Falcon.imageset/Contents.json b/Example-swift/Assets.xcassets/Falcon.imageset/Contents.json deleted file mode 100644 index 357a7b1..0000000 --- a/Example-swift/Assets.xcassets/Falcon.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "falcon.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example-swift/Assets.xcassets/Falcon.imageset/falcon.png b/Example-swift/Assets.xcassets/Falcon.imageset/falcon.png deleted file mode 100644 index 71e237a..0000000 Binary files a/Example-swift/Assets.xcassets/Falcon.imageset/falcon.png and /dev/null differ diff --git a/Example-swift/Assets.xcassets/LaunchImage.launchimage/Contents.json b/Example-swift/Assets.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index ce3fb1a..0000000 --- a/Example-swift/Assets.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,150 +0,0 @@ -{ - "images" : [ - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "subtype" : "retina4", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "8.0", - "subtype" : "736h", - "scale" : "3x" - }, - { - "orientation" : "landscape", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "8.0", - "subtype" : "736h", - "scale" : "3x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "8.0", - "subtype" : "667h", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "8.0", - "subtype" : "1366h", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "subtype" : "retina4", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example-swift/Assets.xcassets/List.imageset/Contents.json b/Example-swift/Assets.xcassets/List.imageset/Contents.json deleted file mode 100644 index 147bded..0000000 --- a/Example-swift/Assets.xcassets/List.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "list-2.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "list-1.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "list.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example-swift/Assets.xcassets/List.imageset/list-1.png b/Example-swift/Assets.xcassets/List.imageset/list-1.png deleted file mode 100644 index f3fd077..0000000 Binary files a/Example-swift/Assets.xcassets/List.imageset/list-1.png and /dev/null differ diff --git a/Example-swift/Assets.xcassets/List.imageset/list-2.png b/Example-swift/Assets.xcassets/List.imageset/list-2.png deleted file mode 100644 index 40b201d..0000000 Binary files a/Example-swift/Assets.xcassets/List.imageset/list-2.png and /dev/null differ diff --git a/Example-swift/Assets.xcassets/List.imageset/list.png b/Example-swift/Assets.xcassets/List.imageset/list.png deleted file mode 100644 index f06507b..0000000 Binary files a/Example-swift/Assets.xcassets/List.imageset/list.png and /dev/null differ diff --git a/Example-swift/Assets.xcassets/Rocket.imageset/Contents.json b/Example-swift/Assets.xcassets/Rocket.imageset/Contents.json deleted file mode 100644 index d431aa8..0000000 --- a/Example-swift/Assets.xcassets/Rocket.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "_111_rocket.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example-swift/Assets.xcassets/Rocket.imageset/_111_rocket.png b/Example-swift/Assets.xcassets/Rocket.imageset/_111_rocket.png deleted file mode 100644 index b2dc478..0000000 Binary files a/Example-swift/Assets.xcassets/Rocket.imageset/_111_rocket.png and /dev/null differ diff --git a/Example-swift/Assets.xcassets/Spaceship.imageset/Contents.json b/Example-swift/Assets.xcassets/Spaceship.imageset/Contents.json deleted file mode 100644 index 4e96dcb..0000000 --- a/Example-swift/Assets.xcassets/Spaceship.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "spaceship.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example-swift/Assets.xcassets/Spaceship.imageset/spaceship.png b/Example-swift/Assets.xcassets/Spaceship.imageset/spaceship.png deleted file mode 100644 index 4afb63e..0000000 Binary files a/Example-swift/Assets.xcassets/Spaceship.imageset/spaceship.png and /dev/null differ diff --git a/Example-swift/AppDelegate.swift b/Example/AppDelegate.swift similarity index 96% rename from Example-swift/AppDelegate.swift rename to Example/AppDelegate.swift index f152ff3..2854da4 100644 --- a/Example-swift/AppDelegate.swift +++ b/Example/AppDelegate.swift @@ -1,6 +1,6 @@ // AppDelegate.swift // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -27,7 +27,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { UITabBar.appearance().tintColor = #colorLiteral(red: 0.5921568627, green: 0.2588235294, blue: 0.2666666667, alpha: 1) // #974244 return true diff --git a/Example-swift/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from Example-swift/Assets.xcassets/AppIcon.appiconset/Contents.json rename to Example/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/Example-objc/Assets.xcassets/Background.imageset/Contents.json b/Example/Assets.xcassets/Background.imageset/Contents.json old mode 100755 new mode 100644 similarity index 100% rename from Example-objc/Assets.xcassets/Background.imageset/Contents.json rename to Example/Assets.xcassets/Background.imageset/Contents.json diff --git a/Example-objc/Assets.xcassets/Background.imageset/_111_background.png b/Example/Assets.xcassets/Background.imageset/_111_background.png old mode 100755 new mode 100644 similarity index 100% rename from Example-objc/Assets.xcassets/Background.imageset/_111_background.png rename to Example/Assets.xcassets/Background.imageset/_111_background.png diff --git a/Example-objc/Assets.xcassets/Background1.imageset/Contents.json b/Example/Assets.xcassets/Background1.imageset/Contents.json old mode 100755 new mode 100644 similarity index 100% rename from Example-objc/Assets.xcassets/Background1.imageset/Contents.json rename to Example/Assets.xcassets/Background1.imageset/Contents.json diff --git a/Example-objc/Assets.xcassets/Background1.imageset/stars.png b/Example/Assets.xcassets/Background1.imageset/stars.png old mode 100755 new mode 100644 similarity index 100% rename from Example-objc/Assets.xcassets/Background1.imageset/stars.png rename to Example/Assets.xcassets/Background1.imageset/stars.png diff --git a/Example-objc/Assets.xcassets/Background2.imageset/Contents.json b/Example/Assets.xcassets/Background2.imageset/Contents.json old mode 100755 new mode 100644 similarity index 100% rename from Example-objc/Assets.xcassets/Background2.imageset/Contents.json rename to Example/Assets.xcassets/Background2.imageset/Contents.json diff --git a/Example-objc/Assets.xcassets/Background2.imageset/stars.png b/Example/Assets.xcassets/Background2.imageset/stars.png old mode 100755 new mode 100644 similarity index 100% rename from Example-objc/Assets.xcassets/Background2.imageset/stars.png rename to Example/Assets.xcassets/Background2.imageset/stars.png diff --git a/Example-objc/Assets.xcassets/Contents.json b/Example/Assets.xcassets/Contents.json old mode 100755 new mode 100644 similarity index 100% rename from Example-objc/Assets.xcassets/Contents.json rename to Example/Assets.xcassets/Contents.json diff --git a/Example-objc/Assets.xcassets/Falcon.imageset/Contents.json b/Example/Assets.xcassets/Falcon.imageset/Contents.json old mode 100755 new mode 100644 similarity index 100% rename from Example-objc/Assets.xcassets/Falcon.imageset/Contents.json rename to Example/Assets.xcassets/Falcon.imageset/Contents.json diff --git a/Example-objc/Assets.xcassets/Falcon.imageset/falcon.png b/Example/Assets.xcassets/Falcon.imageset/falcon.png old mode 100755 new mode 100644 similarity index 100% rename from Example-objc/Assets.xcassets/Falcon.imageset/falcon.png rename to Example/Assets.xcassets/Falcon.imageset/falcon.png diff --git a/Example-objc/Assets.xcassets/List.imageset/Contents.json b/Example/Assets.xcassets/List.imageset/Contents.json old mode 100755 new mode 100644 similarity index 100% rename from Example-objc/Assets.xcassets/List.imageset/Contents.json rename to Example/Assets.xcassets/List.imageset/Contents.json diff --git a/Example-objc/Assets.xcassets/List.imageset/list-1.png b/Example/Assets.xcassets/List.imageset/list-1.png old mode 100755 new mode 100644 similarity index 100% rename from Example-objc/Assets.xcassets/List.imageset/list-1.png rename to Example/Assets.xcassets/List.imageset/list-1.png diff --git a/Example-objc/Assets.xcassets/List.imageset/list-2.png b/Example/Assets.xcassets/List.imageset/list-2.png old mode 100755 new mode 100644 similarity index 100% rename from Example-objc/Assets.xcassets/List.imageset/list-2.png rename to Example/Assets.xcassets/List.imageset/list-2.png diff --git a/Example-objc/Assets.xcassets/List.imageset/list.png b/Example/Assets.xcassets/List.imageset/list.png old mode 100755 new mode 100644 similarity index 100% rename from Example-objc/Assets.xcassets/List.imageset/list.png rename to Example/Assets.xcassets/List.imageset/list.png diff --git a/Example-objc/Assets.xcassets/Rocket.imageset/Contents.json b/Example/Assets.xcassets/Rocket.imageset/Contents.json old mode 100755 new mode 100644 similarity index 100% rename from Example-objc/Assets.xcassets/Rocket.imageset/Contents.json rename to Example/Assets.xcassets/Rocket.imageset/Contents.json diff --git a/Example-objc/Assets.xcassets/Rocket.imageset/_111_rocket.png b/Example/Assets.xcassets/Rocket.imageset/_111_rocket.png old mode 100755 new mode 100644 similarity index 100% rename from Example-objc/Assets.xcassets/Rocket.imageset/_111_rocket.png rename to Example/Assets.xcassets/Rocket.imageset/_111_rocket.png diff --git a/Example-objc/Assets.xcassets/Spaceship.imageset/Contents.json b/Example/Assets.xcassets/Spaceship.imageset/Contents.json old mode 100755 new mode 100644 similarity index 100% rename from Example-objc/Assets.xcassets/Spaceship.imageset/Contents.json rename to Example/Assets.xcassets/Spaceship.imageset/Contents.json diff --git a/Example-objc/Assets.xcassets/Spaceship.imageset/spaceship.png b/Example/Assets.xcassets/Spaceship.imageset/spaceship.png old mode 100755 new mode 100644 similarity index 100% rename from Example-objc/Assets.xcassets/Spaceship.imageset/spaceship.png rename to Example/Assets.xcassets/Spaceship.imageset/spaceship.png diff --git a/Example-swift/Base.lproj/LaunchScreen.storyboard b/Example/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from Example-swift/Base.lproj/LaunchScreen.storyboard rename to Example/Base.lproj/LaunchScreen.storyboard diff --git a/Example-swift/Base.lproj/Main.storyboard b/Example/Base.lproj/Main.storyboard similarity index 61% rename from Example-swift/Base.lproj/Main.storyboard rename to Example/Base.lproj/Main.storyboard index e9deaf4..7585fd5 100644 --- a/Example-swift/Base.lproj/Main.storyboard +++ b/Example/Base.lproj/Main.storyboard @@ -1,10 +1,10 @@ - - + + + - - - + + @@ -13,20 +13,20 @@ - + - + - + @@ -84,27 +88,21 @@ - - - - - + + - - - - + @@ -115,94 +113,116 @@ - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + + + + + + + + - - - - + + + + + - - - - - - - - - - - - - - - - - - - + - + - + @@ -227,16 +247,15 @@ - - - - - + + + + @@ -247,11 +266,12 @@ - + - - + + + diff --git a/Example-swift/Info.plist b/Example/Info.plist similarity index 100% rename from Example-swift/Info.plist rename to Example/Info.plist diff --git a/Example-swift/MXFalconViewController.swift b/Example/MXFalconViewController.swift similarity index 86% rename from Example-swift/MXFalconViewController.swift rename to Example/MXFalconViewController.swift index b9ec87c..08d7ad8 100644 --- a/Example-swift/MXFalconViewController.swift +++ b/Example/MXFalconViewController.swift @@ -1,6 +1,6 @@ // MXFalconViewController.swift // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -32,16 +32,11 @@ class MXFalconViewController: UIViewController, MXParallaxHeaderDelegate { parallaxHeader?.delegate = self } - - override func didReceiveMemoryWarning() { - super.didReceiveMemoryWarning() - // Dispose of any resources that can be recreated. - } // MARK: - MXParallaxHeaderDelegate func parallaxHeaderDidScroll(_ parallaxHeader: MXParallaxHeader) { - let angle = parallaxHeader.progress * CGFloat(M_PI) * 2 + let angle = parallaxHeader.progress * CGFloat(Double.pi) * 2 self.falcon.transform = CGAffineTransform.identity.rotated(by: angle) } diff --git a/Example-swift/MXScrollViewExample.swift b/Example/MXScrollViewExample.swift similarity index 55% rename from Example-swift/MXScrollViewExample.swift rename to Example/MXScrollViewExample.swift index e0ea76e..f488a0d 100644 --- a/Example-swift/MXScrollViewExample.swift +++ b/Example/MXScrollViewExample.swift @@ -1,6 +1,6 @@ // MXScrollViewExample.swift // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -27,51 +27,23 @@ class MXScrollViewExample: UIViewController, UITableViewDelegate, UITableViewDat fileprivate var SpanichWhite : UIColor = #colorLiteral(red: 0.9960784314, green: 0.9921568627, blue: 0.9411764706, alpha: 1) // #FEFDF0 - var scrollView: MXScrollView! - var table1: UITableView! - var table2: UITableView! + @IBOutlet weak var scrollView: MXScrollView! + @IBOutlet weak var table1: UITableView! + @IBOutlet weak var table2: UITableView! override func viewDidLoad() { super.viewDidLoad() // Parallax Header - scrollView = MXScrollView() - scrollView.parallaxHeader.view = Bundle.main.loadNibNamed("StarshipHeader", owner: self, options: nil)?.first as? UIView // You can set the parallax header view from a nib. + scrollView.parallaxHeader.load(withNibName: "StarshipHeader", bundle: nil, options: nil) // You can set the parallax header view from a nib. scrollView.parallaxHeader.height = 300 - scrollView.parallaxHeader.mode = MXParallaxHeaderMode.fill - view.addSubview(scrollView) - - table1 = UITableView() - table1.dataSource = self; + scrollView.parallaxHeader.mode = .fill + table1.backgroundColor = SpanichWhite - scrollView.addSubview(table1) - - table2 = UITableView() - table2.dataSource = self; - table2.backgroundColor = SpanichWhite - scrollView.addSubview(table2) - } + table1.register(UITableViewCell.self, forCellReuseIdentifier: "cell") - override func viewDidAppear(_ animated: Bool) { - super.viewDidAppear(animated) - - scrollView.parallaxHeader.minimumHeight = topLayoutGuide.length - } - - override func viewDidLayoutSubviews() { - super.viewDidLayoutSubviews() - - var frame = view.frame - - scrollView.frame = frame - scrollView.contentSize = frame.size - - frame.size.width /= 2 - frame.size.height -= scrollView.parallaxHeader.minimumHeight - table1.frame = frame - - frame.origin.x = frame.size.width - table2.frame = frame + table2.backgroundColor = SpanichWhite + table2.register(UITableViewCell.self, forCellReuseIdentifier: "cell") } // MARK: - Table view data source @@ -81,15 +53,10 @@ class MXScrollViewExample: UIViewController, UITableViewDelegate, UITableViewDat } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let CellIdentifier = "Cell" - - var cell = tableView.dequeueReusableCell(withIdentifier: CellIdentifier) - if (cell == nil) { - cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: CellIdentifier) - } - cell!.textLabel!.text = String(format: "Row %ld", indexPath.row * 10) - cell!.backgroundColor = SpanichWhite; - return cell! + let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) + cell.textLabel?.text = String(format: "Row %ld", indexPath.row * 10) + cell.backgroundColor = SpanichWhite; + return cell } // MARK: - Scroll view delegate diff --git a/Example-swift/MXWebViewController.swift b/Example/MXWebViewController.swift similarity index 78% rename from Example-swift/MXWebViewController.swift rename to Example/MXWebViewController.swift index c7cdbcc..1d3d5fe 100644 --- a/Example-swift/MXWebViewController.swift +++ b/Example/MXWebViewController.swift @@ -1,6 +1,6 @@ // MXChildViewController.swift // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -21,28 +21,17 @@ // THE SOFTWARE. import UIKit +import WebKit import MXParallaxHeader class MXWebViewController: UIViewController { - - @IBOutlet weak var webView: UIWebView! + + @IBOutlet weak var webView: WKWebView! override func viewDidLoad() { super.viewDidLoad() let request = URLRequest(url: URL(string: "https://dribbble.com/search?q=spaceship")!) - webView.loadRequest(request) - } - - @IBAction func back(_ sender: AnyObject) { - webView.goBack() - } - - @IBAction func forward(_ sender: AnyObject) { - webView.goForward() - } - - @IBAction func refresh(_ sender: AnyObject) { - webView.reload() + webView.load(request) } } diff --git a/Example-swift/StarshipHeader.xib b/Example/StarshipHeader.xib similarity index 76% rename from Example-swift/StarshipHeader.xib rename to Example/StarshipHeader.xib index 7d5f902..13bea1b 100644 --- a/Example-swift/StarshipHeader.xib +++ b/Example/StarshipHeader.xib @@ -1,20 +1,29 @@ - - + + + + + - - + - + + + + + - + - + + + + diff --git a/Example-swift/UIScrollViewExample.swift b/Example/UIScrollViewExample.swift similarity index 93% rename from Example-swift/UIScrollViewExample.swift rename to Example/UIScrollViewExample.swift index 0313a40..01a7bc0 100644 --- a/Example-swift/UIScrollViewExample.swift +++ b/Example/UIScrollViewExample.swift @@ -1,6 +1,6 @@ // UIScrollViewExample.swift // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -33,14 +33,14 @@ class UIScrollViewExample: UITableViewController, MXParallaxHeaderDelegate { // Parallax Header tableView.parallaxHeader.view = headerView // You can set the parallax header view from the floating view tableView.parallaxHeader.height = 300 - tableView.parallaxHeader.mode = MXParallaxHeaderMode.fill + tableView.parallaxHeader.mode = .fill tableView.parallaxHeader.delegate = self } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) - tableView.parallaxHeader.minimumHeight = topLayoutGuide.length + tableView.parallaxHeader.minimumHeight = view.safeAreaInsets.top } // MARK: - Table view data source diff --git a/Example-objc/demo1.gif b/Example/demo1.gif similarity index 100% rename from Example-objc/demo1.gif rename to Example/demo1.gif diff --git a/Example-objc/demo2.gif b/Example/demo2.gif similarity index 100% rename from Example-objc/demo2.gif rename to Example/demo2.gif diff --git a/Framework/Info.plist b/Framework/Info.plist index b1786cd..ec0cc7b 100644 --- a/Framework/Info.plist +++ b/Framework/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.6.1 + $(MARKETING_VERSION) CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass diff --git a/LICENSE b/LICENSE index a69fd8b..d2c7723 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2017 Maxime Epain +Copyright (c) 2019 Maxime Epain 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/MXParallaxHeader.podspec b/MXParallaxHeader.podspec index 331b8a1..8ae8db7 100644 --- a/MXParallaxHeader.podspec +++ b/MXParallaxHeader.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = "MXParallaxHeader" - s.version = "0.6.1" + s.version = "1.1.0" s.summary = "Simple parallax header for UIScrollView." s.description = <<-DESC MXParallaxHeader is a simple header class for UIScrolView. @@ -23,9 +23,9 @@ Pod::Spec.new do |s| s.source = { :git => "https://github.com/maxep/MXParallaxHeader.git", :tag => s.version.to_s } s.social_media_url = 'https://twitter.com/MaximeEpain' - s.platform = :ios, '7.0' + s.platform = :ios, '9.0' s.requires_arc = true - s.source_files = 'MXParallaxHeader/*.{m,h}' + s.source_files = 'Sources/*.{m,h}' end diff --git a/MXParallaxHeader.xcodeproj/project.pbxproj b/MXParallaxHeader.xcodeproj/project.pbxproj index 66a1311..0b57e27 100644 --- a/MXParallaxHeader.xcodeproj/project.pbxproj +++ b/MXParallaxHeader.xcodeproj/project.pbxproj @@ -14,17 +14,6 @@ 9C01BC891DA3E56A0032494C /* MXScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C01BC831DA3E56A0032494C /* MXScrollView.m */; }; 9C01BC8A1DA3E56A0032494C /* MXScrollViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C01BC841DA3E56A0032494C /* MXScrollViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 9C01BC8B1DA3E56A0032494C /* MXScrollViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C01BC851DA3E56A0032494C /* MXScrollViewController.m */; }; - 9C01BC941DA3E6810032494C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C01BC931DA3E6810032494C /* main.m */; }; - 9C01BC9D1DA3E6810032494C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9C01BC9B1DA3E6810032494C /* Main.storyboard */; }; - 9C01BC9F1DA3E6810032494C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9C01BC9E1DA3E6810032494C /* Assets.xcassets */; }; - 9C01BCA91DA3E71E0032494C /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9C01BCA71DA3E71E0032494C /* Launch Screen.storyboard */; }; - 9C01BCB51DA3E7330032494C /* MXAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C01BCAB1DA3E7330032494C /* MXAppDelegate.m */; }; - 9C01BCB61DA3E7330032494C /* MXScrollViewExample.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C01BCAE1DA3E7330032494C /* MXScrollViewExample.m */; }; - 9C01BCB71DA3E7330032494C /* UIScrollViewExample.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C01BCB11DA3E7330032494C /* UIScrollViewExample.m */; }; - 9C01BCB81DA3E7330032494C /* MXWebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C01BCB41DA3E7330032494C /* MXWebViewController.m */; }; - 9C01BCBB1DA3E7480032494C /* MXParallaxHeader.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C01BC6F1DA3E4D40032494C /* MXParallaxHeader.framework */; }; - 9C01BCBC1DA3E7480032494C /* MXParallaxHeader.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9C01BC6F1DA3E4D40032494C /* MXParallaxHeader.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 9C01BCC31DA3E7900032494C /* StarshipHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9C01BCC11DA3E7900032494C /* StarshipHeader.xib */; }; 9C01BCCB1DA3E9A80032494C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C01BCCA1DA3E9A80032494C /* AppDelegate.swift */; }; 9C01BCD01DA3E9A80032494C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9C01BCCE1DA3E9A80032494C /* Main.storyboard */; }; 9C01BCD21DA3E9A80032494C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9C01BCD11DA3E9A80032494C /* Assets.xcassets */; }; @@ -35,19 +24,11 @@ 9C01BCE71DA3EBBA0032494C /* UIScrollViewExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C01BCE11DA3EBBA0032494C /* UIScrollViewExample.swift */; }; 9C01BCEA1DA3EBFE0032494C /* MXParallaxHeader.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C01BC6F1DA3E4D40032494C /* MXParallaxHeader.framework */; }; 9C01BCEB1DA3EBFE0032494C /* MXParallaxHeader.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9C01BC6F1DA3E4D40032494C /* MXParallaxHeader.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 9C7904261DC23C4900149A7E /* MXFalconViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C7904241DC23C4800149A7E /* MXFalconViewController.h */; }; - 9C79042A1DC243C100149A7E /* MXFalconViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C7904251DC23C4900149A7E /* MXFalconViewController.m */; }; + 9C71819522856FFF007F7894 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C71819422856FFF007F7894 /* WebKit.framework */; }; 9C79042B1DC243C800149A7E /* MXFalconViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C7904281DC242A800149A7E /* MXFalconViewController.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 9C01BCB91DA3E7430032494C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9C01BC661DA3E4D40032494C /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9C01BC6E1DA3E4D40032494C; - remoteInfo = MXParallaxHeader; - }; 9C01BCE81DA3EBE60032494C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9C01BC661DA3E4D40032494C /* Project object */; @@ -58,17 +39,6 @@ /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ - 9C01BCBD1DA3E7480032494C /* Embed Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - 9C01BCBC1DA3E7480032494C /* MXParallaxHeader.framework in Embed Frameworks */, - ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; 9C01BCEC1DA3EBFE0032494C /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -92,22 +62,7 @@ 9C01BC831DA3E56A0032494C /* MXScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXScrollView.m; sourceTree = ""; }; 9C01BC841DA3E56A0032494C /* MXScrollViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXScrollViewController.h; sourceTree = ""; }; 9C01BC851DA3E56A0032494C /* MXScrollViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXScrollViewController.m; sourceTree = ""; }; - 9C01BC901DA3E6810032494C /* MXParallaxHeader-objc.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "MXParallaxHeader-objc.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - 9C01BC931DA3E6810032494C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 9C01BC9C1DA3E6810032494C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 9C01BC9E1DA3E6810032494C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 9C01BCA31DA3E6810032494C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9C01BCA81DA3E71E0032494C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = "Base.lproj/Launch Screen.storyboard"; sourceTree = ""; }; - 9C01BCAA1DA3E7330032494C /* MXAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXAppDelegate.h; sourceTree = ""; }; - 9C01BCAB1DA3E7330032494C /* MXAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXAppDelegate.m; sourceTree = ""; }; - 9C01BCAD1DA3E7330032494C /* MXScrollViewExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXScrollViewExample.h; sourceTree = ""; }; - 9C01BCAE1DA3E7330032494C /* MXScrollViewExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXScrollViewExample.m; sourceTree = ""; }; - 9C01BCB01DA3E7330032494C /* UIScrollViewExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScrollViewExample.h; sourceTree = ""; }; - 9C01BCB11DA3E7330032494C /* UIScrollViewExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIScrollViewExample.m; sourceTree = ""; }; - 9C01BCB31DA3E7330032494C /* MXWebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXWebViewController.h; sourceTree = ""; }; - 9C01BCB41DA3E7330032494C /* MXWebViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXWebViewController.m; sourceTree = ""; }; - 9C01BCC11DA3E7900032494C /* StarshipHeader.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = StarshipHeader.xib; path = ../UIScrollView/StarshipHeader.xib; sourceTree = ""; }; - 9C01BCC81DA3E9A80032494C /* MXParallaxHeader-swift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "MXParallaxHeader-swift.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 9C01BCC81DA3E9A80032494C /* MXParallaxHeader Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "MXParallaxHeader Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 9C01BCCA1DA3E9A80032494C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 9C01BCCF1DA3E9A80032494C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 9C01BCD11DA3E9A80032494C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -121,8 +76,7 @@ 9C01BCEF1DA3F0E20032494C /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; 9C01BCF01DA3F0E20032494C /* MXParallaxHeader.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; path = MXParallaxHeader.podspec; sourceTree = ""; }; 9C01BCF11DA3F0E20032494C /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; - 9C7904241DC23C4800149A7E /* MXFalconViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXFalconViewController.h; sourceTree = ""; }; - 9C7904251DC23C4900149A7E /* MXFalconViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXFalconViewController.m; sourceTree = ""; }; + 9C71819422856FFF007F7894 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; 9C7904281DC242A800149A7E /* MXFalconViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MXFalconViewController.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -134,18 +88,11 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 9C01BC8D1DA3E6810032494C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9C01BCBB1DA3E7480032494C /* MXParallaxHeader.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 9C01BCC51DA3E9A80032494C /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 9C71819522856FFF007F7894 /* WebKit.framework in Frameworks */, 9C01BCEA1DA3EBFE0032494C /* MXParallaxHeader.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -157,11 +104,11 @@ isa = PBXGroup; children = ( 9C01BCED1DA3F0C80032494C /* Metadata */, - 9C01BC7F1DA3E56A0032494C /* MXParallaxHeader */, + 9C01BC7F1DA3E56A0032494C /* Sources */, 9C01BC7A1DA3E54C0032494C /* Framework */, - 9C01BC911DA3E6810032494C /* Example-objc */, - 9C01BCC91DA3E9A80032494C /* Example-swift */, + 9C01BCC91DA3E9A80032494C /* Example */, 9C01BC701DA3E4D40032494C /* Products */, + 9C71819322856FFF007F7894 /* Frameworks */, ); sourceTree = ""; }; @@ -169,8 +116,7 @@ isa = PBXGroup; children = ( 9C01BC6F1DA3E4D40032494C /* MXParallaxHeader.framework */, - 9C01BC901DA3E6810032494C /* MXParallaxHeader-objc.app */, - 9C01BCC81DA3E9A80032494C /* MXParallaxHeader-swift.app */, + 9C01BCC81DA3E9A80032494C /* MXParallaxHeader Example.app */, ); name = Products; sourceTree = ""; @@ -184,7 +130,7 @@ name = Framework; sourceTree = ""; }; - 9C01BC7F1DA3E56A0032494C /* MXParallaxHeader */ = { + 9C01BC7F1DA3E56A0032494C /* Sources */ = { isa = PBXGroup; children = ( 9C01BC801DA3E56A0032494C /* MXParallaxHeader.h */, @@ -194,65 +140,10 @@ 9C01BC841DA3E56A0032494C /* MXScrollViewController.h */, 9C01BC851DA3E56A0032494C /* MXScrollViewController.m */, ); - path = MXParallaxHeader; - sourceTree = ""; - }; - 9C01BC911DA3E6810032494C /* Example-objc */ = { - isa = PBXGroup; - children = ( - 9C01BCAA1DA3E7330032494C /* MXAppDelegate.h */, - 9C01BCAB1DA3E7330032494C /* MXAppDelegate.m */, - 9C01BCAF1DA3E7330032494C /* UIScrollView */, - 9C01BCAC1DA3E7330032494C /* MXScrollView */, - 9C01BCB21DA3E7330032494C /* UIScrollViewController */, - 9C01BC9B1DA3E6810032494C /* Main.storyboard */, - 9C01BCA71DA3E71E0032494C /* Launch Screen.storyboard */, - 9C01BC9E1DA3E6810032494C /* Assets.xcassets */, - 9C01BCA31DA3E6810032494C /* Info.plist */, - 9C01BC921DA3E6810032494C /* Supporting Files */, - ); - path = "Example-objc"; + path = Sources; sourceTree = ""; }; - 9C01BC921DA3E6810032494C /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 9C01BC931DA3E6810032494C /* main.m */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 9C01BCAC1DA3E7330032494C /* MXScrollView */ = { - isa = PBXGroup; - children = ( - 9C01BCAD1DA3E7330032494C /* MXScrollViewExample.h */, - 9C01BCAE1DA3E7330032494C /* MXScrollViewExample.m */, - 9C01BCC11DA3E7900032494C /* StarshipHeader.xib */, - ); - path = MXScrollView; - sourceTree = ""; - }; - 9C01BCAF1DA3E7330032494C /* UIScrollView */ = { - isa = PBXGroup; - children = ( - 9C01BCB01DA3E7330032494C /* UIScrollViewExample.h */, - 9C01BCB11DA3E7330032494C /* UIScrollViewExample.m */, - ); - path = UIScrollView; - sourceTree = ""; - }; - 9C01BCB21DA3E7330032494C /* UIScrollViewController */ = { - isa = PBXGroup; - children = ( - 9C7904241DC23C4800149A7E /* MXFalconViewController.h */, - 9C7904251DC23C4900149A7E /* MXFalconViewController.m */, - 9C01BCB31DA3E7330032494C /* MXWebViewController.h */, - 9C01BCB41DA3E7330032494C /* MXWebViewController.m */, - ); - path = UIScrollViewController; - sourceTree = ""; - }; - 9C01BCC91DA3E9A80032494C /* Example-swift */ = { + 9C01BCC91DA3E9A80032494C /* Example */ = { isa = PBXGroup; children = ( 9C01BCCA1DA3E9A80032494C /* AppDelegate.swift */, @@ -266,7 +157,7 @@ 9C01BCD31DA3E9A80032494C /* LaunchScreen.storyboard */, 9C01BCD61DA3E9A80032494C /* Info.plist */, ); - path = "Example-swift"; + path = Example; sourceTree = ""; }; 9C01BCED1DA3F0C80032494C /* Metadata */ = { @@ -280,6 +171,14 @@ name = Metadata; sourceTree = ""; }; + 9C71819322856FFF007F7894 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 9C71819422856FFF007F7894 /* WebKit.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -291,7 +190,6 @@ 9C01BC8A1DA3E56A0032494C /* MXScrollViewController.h in Headers */, 9C01BC881DA3E56A0032494C /* MXScrollView.h in Headers */, 9C01BC861DA3E56A0032494C /* MXParallaxHeader.h in Headers */, - 9C7904261DC23C4900149A7E /* MXFalconViewController.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -316,28 +214,9 @@ productReference = 9C01BC6F1DA3E4D40032494C /* MXParallaxHeader.framework */; productType = "com.apple.product-type.framework"; }; - 9C01BC8F1DA3E6810032494C /* MXParallaxHeader-objc */ = { - isa = PBXNativeTarget; - buildConfigurationList = 9C01BCA41DA3E6810032494C /* Build configuration list for PBXNativeTarget "MXParallaxHeader-objc" */; - buildPhases = ( - 9C01BC8C1DA3E6810032494C /* Sources */, - 9C01BC8D1DA3E6810032494C /* Frameworks */, - 9C01BC8E1DA3E6810032494C /* Resources */, - 9C01BCBD1DA3E7480032494C /* Embed Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 9C01BCBA1DA3E7430032494C /* PBXTargetDependency */, - ); - name = "MXParallaxHeader-objc"; - productName = "MXParallaxHeader-objc"; - productReference = 9C01BC901DA3E6810032494C /* MXParallaxHeader-objc.app */; - productType = "com.apple.product-type.application"; - }; - 9C01BCC71DA3E9A80032494C /* MXParallaxHeader-swift */ = { + 9C01BCC71DA3E9A80032494C /* MXParallaxHeader Example */ = { isa = PBXNativeTarget; - buildConfigurationList = 9C01BCD71DA3E9A80032494C /* Build configuration list for PBXNativeTarget "MXParallaxHeader-swift" */; + buildConfigurationList = 9C01BCD71DA3E9A80032494C /* Build configuration list for PBXNativeTarget "MXParallaxHeader Example" */; buildPhases = ( 9C01BCC41DA3E9A80032494C /* Sources */, 9C01BCC51DA3E9A80032494C /* Frameworks */, @@ -349,9 +228,9 @@ dependencies = ( 9C01BCE91DA3EBE60032494C /* PBXTargetDependency */, ); - name = "MXParallaxHeader-swift"; + name = "MXParallaxHeader Example"; productName = "MXParallaxHeader-swift"; - productReference = 9C01BCC81DA3E9A80032494C /* MXParallaxHeader-swift.app */; + productReference = 9C01BCC81DA3E9A80032494C /* MXParallaxHeader Example.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ @@ -361,7 +240,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0800; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = maxep; TargetAttributes = { 9C01BC6E1DA3E4D40032494C = { @@ -370,22 +249,17 @@ LastSwiftMigration = 0800; ProvisioningStyle = Automatic; }; - 9C01BC8F1DA3E6810032494C = { - CreatedOnToolsVersion = 8.0; - DevelopmentTeam = C75GEDTP26; - ProvisioningStyle = Automatic; - }; 9C01BCC71DA3E9A80032494C = { CreatedOnToolsVersion = 8.0; DevelopmentTeam = C75GEDTP26; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; }; }; buildConfigurationList = 9C01BC691DA3E4D40032494C /* Build configuration list for PBXProject "MXParallaxHeader" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -397,8 +271,7 @@ projectRoot = ""; targets = ( 9C01BC6E1DA3E4D40032494C /* MXParallaxHeader */, - 9C01BC8F1DA3E6810032494C /* MXParallaxHeader-objc */, - 9C01BCC71DA3E9A80032494C /* MXParallaxHeader-swift */, + 9C01BCC71DA3E9A80032494C /* MXParallaxHeader Example */, ); }; /* End PBXProject section */ @@ -411,17 +284,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 9C01BC8E1DA3E6810032494C /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 9C01BCA91DA3E71E0032494C /* Launch Screen.storyboard in Resources */, - 9C01BC9F1DA3E6810032494C /* Assets.xcassets in Resources */, - 9C01BCC31DA3E7900032494C /* StarshipHeader.xib in Resources */, - 9C01BC9D1DA3E6810032494C /* Main.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 9C01BCC61DA3E9A80032494C /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -446,19 +308,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 9C01BC8C1DA3E6810032494C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 9C01BCB71DA3E7330032494C /* UIScrollViewExample.m in Sources */, - 9C01BCB81DA3E7330032494C /* MXWebViewController.m in Sources */, - 9C01BC941DA3E6810032494C /* main.m in Sources */, - 9C01BCB61DA3E7330032494C /* MXScrollViewExample.m in Sources */, - 9C01BCB51DA3E7330032494C /* MXAppDelegate.m in Sources */, - 9C79042A1DC243C100149A7E /* MXFalconViewController.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 9C01BCC41DA3E9A80032494C /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -474,11 +323,6 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 9C01BCBA1DA3E7430032494C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9C01BC6E1DA3E4D40032494C /* MXParallaxHeader */; - targetProxy = 9C01BCB91DA3E7430032494C /* PBXContainerItemProxy */; - }; 9C01BCE91DA3EBE60032494C /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 9C01BC6E1DA3E4D40032494C /* MXParallaxHeader */; @@ -487,22 +331,6 @@ /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ - 9C01BC9B1DA3E6810032494C /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 9C01BC9C1DA3E6810032494C /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - 9C01BCA71DA3E71E0032494C /* Launch Screen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 9C01BCA81DA3E71E0032494C /* Base */, - ); - name = "Launch Screen.storyboard"; - sourceTree = ""; - }; 9C01BCCE1DA3E9A80032494C /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( @@ -526,6 +354,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -535,6 +364,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -542,6 +372,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -584,6 +415,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -593,6 +425,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -600,6 +433,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -645,7 +479,9 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Framework/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MARKETING_VERSION = 1.1.0; MODULEMAP_FILE = Framework/module.modulemap; PRODUCT_BUNDLE_IDENTIFIER = fr.maxep.MXParallaxHeader; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -667,7 +503,9 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Framework/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MARKETING_VERSION = 1.1.0; MODULEMAP_FILE = Framework/module.modulemap; PRODUCT_BUNDLE_IDENTIFIER = fr.maxep.MXParallaxHeader; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -676,45 +514,19 @@ }; name = Release; }; - 9C01BCA51DA3E6810032494C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - DEVELOPMENT_TEAM = C75GEDTP26; - INFOPLIST_FILE = "$(SRCROOT)/Example-objc/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "fr.maxep.MXParallaxHeader-objc"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 9C01BCA61DA3E6810032494C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - DEVELOPMENT_TEAM = C75GEDTP26; - INFOPLIST_FILE = "$(SRCROOT)/Example-objc/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "fr.maxep.MXParallaxHeader-objc"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; 9C01BCD81DA3E9A80032494C /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; DEVELOPMENT_TEAM = C75GEDTP26; - INFOPLIST_FILE = "$(SRCROOT)/Example-swift/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Example/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "fr.maxep.MXParallaxHeader-swift"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -722,14 +534,14 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; DEVELOPMENT_TEAM = C75GEDTP26; - INFOPLIST_FILE = "$(SRCROOT)/Example-swift/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Example/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "fr.maxep.MXParallaxHeader-swift"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -754,16 +566,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 9C01BCA41DA3E6810032494C /* Build configuration list for PBXNativeTarget "MXParallaxHeader-objc" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9C01BCA51DA3E6810032494C /* Debug */, - 9C01BCA61DA3E6810032494C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 9C01BCD71DA3E9A80032494C /* Build configuration list for PBXNativeTarget "MXParallaxHeader-swift" */ = { + 9C01BCD71DA3E9A80032494C /* Build configuration list for PBXNativeTarget "MXParallaxHeader Example" */ = { isa = XCConfigurationList; buildConfigurations = ( 9C01BCD81DA3E9A80032494C /* Debug */, diff --git a/MXParallaxHeader.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/MXParallaxHeader.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/MXParallaxHeader.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/MXParallaxHeader.xcodeproj/xcshareddata/xcschemes/Example.xcscheme b/MXParallaxHeader.xcodeproj/xcshareddata/xcschemes/Example.xcscheme new file mode 100644 index 0000000..93a9eca --- /dev/null +++ b/MXParallaxHeader.xcodeproj/xcshareddata/xcschemes/Example.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MXParallaxHeader.xcodeproj/xcshareddata/xcschemes/MXParallaxHeader.xcscheme b/MXParallaxHeader.xcodeproj/xcshareddata/xcschemes/MXParallaxHeader.xcscheme index a0363a0..24a4c15 100644 --- a/MXParallaxHeader.xcodeproj/xcshareddata/xcschemes/MXParallaxHeader.xcscheme +++ b/MXParallaxHeader.xcodeproj/xcshareddata/xcschemes/MXParallaxHeader.xcscheme @@ -1,6 +1,6 @@ @@ -37,7 +36,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..411eb75 --- /dev/null +++ b/Package.swift @@ -0,0 +1,25 @@ +// swift-tools-version:5.2 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "MXParallaxHeader", + platforms: [ .iOS(.v9)], + products: [ + .library( + name: "MXParallaxHeader", + targets: ["MXParallaxHeader"]), + ], + dependencies: [ + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages which this package depends on. + .target( + name: "MXParallaxHeader", + dependencies: [], + path: "Sources", + publicHeadersPath: ".") + ] +) diff --git a/README.md b/README.md index 6897f0c..1b3bde6 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,15 @@ [![License](https://img.shields.io/cocoapods/l/MXParallaxHeader.svg?style=flat)](http://cocoapods.org/pods/MXParallaxHeader) [![Platform](https://img.shields.io/cocoapods/p/MXParallaxHeader.svg?style=flat)](http://cocoapods.org/pods/MXParallaxHeader) -MXParallaxHeader is a simple header class for UIScrolView. +:warning: This project is no longer maintained, see [#124](https://github.com/maxep/MXParallaxHeader/issues/124) :warning: + +MXParallaxHeader is a simple header class for UIScrollView. In addition, MXScrollView is a UIScrollView subclass with the ability to hook the vertical scroll from its subviews, this can be used to add a parallax header to complex view hierachy. Moreover, MXScrollViewController allows you to add a MXParallaxHeader to any kind of UIViewController. | UIScrollView | MXScrollViewController | |---------------------------------|-------------------------------------------| -|![Demo](Example-objc/demo1.gif)|![Demo](Example-objc/demo2.gif)| +|![Demo](Example/demo1.gif)|![Demo](Example/demo2.gif)| ## Usage @@ -24,24 +26,57 @@ pod try MXParallaxHeader + Adding a parallax header to a UIScrollView is straightforward, e.g: +
+Swift + +```swift +let headerView = UIImageView() +headerView.image = UIImage(named: "success-baby") +headerView.contentMode = .scaleAspectFit + +let scrollView = UIScrollView() +scrollView.parallaxHeader.view = headerView +scrollView.parallaxHeader.height = 150 +scrollView.parallaxHeader.mode = .fill +scrollView.parallaxHeader.minimumHeight = 20 +``` +
+ +
+Objective-C + ```objective-c UIImageView *headerView = [UIImageView new]; headerView.image = [UIImage imageNamed:@"success-baby"]; headerView.contentMode = UIViewContentModeScaleAspectFill; - + UIScrollView *scrollView = [UIScrollView new]; scrollView.parallaxHeader.view = headerView; scrollView.parallaxHeader.height = 150; scrollView.parallaxHeader.mode = MXParallaxHeaderModeFill; scrollView.parallaxHeader.minimumHeight = 20; ``` +
+ + The MXScrollViewController is a container with a child view controller that can be added programmatically or using the custom segue MXScrollViewControllerSegue. -+ Please check examples for **ObjC/Swift** implementations. ++ Please check examples for **Swift** implementations. ## Installation +### Swift Package Manager + +You can use [Swift Package Manager](https://swift.org/package-manager/) directly within Xcode or add it to the `dependencies` value of your `Package.swift`. + +```swift +dependencies: [ + .package(url: "https://github.com/mexp/MXParallaxHeader", .upToNextMajor(from: "1.1.0")) +] +``` + +### CocoaPods + MXParallaxHeader is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile: diff --git a/MXParallaxHeader/MXParallaxHeader.h b/Sources/MXParallaxHeader.h similarity index 84% rename from MXParallaxHeader/MXParallaxHeader.h rename to Sources/MXParallaxHeader.h index 60373ff..ecbf037 100644 --- a/MXParallaxHeader/MXParallaxHeader.h +++ b/Sources/MXParallaxHeader.h @@ -1,6 +1,6 @@ // MXParallaxHeader.h // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -73,7 +73,7 @@ typedef NS_ENUM(NSInteger, MXParallaxHeaderMode) { @property (nonatomic,strong,nullable) IBOutlet UIView *view; /** - The header's default height. 0 0 by default. + The header's default height. 0 by default. */ @property (nonatomic) IBInspectable CGFloat height; @@ -92,6 +92,15 @@ typedef NS_ENUM(NSInteger, MXParallaxHeaderMode) { */ @property (nonatomic,readonly) CGFloat progress; +/** + Loads a `view` from the nib file in the specified bundle. + + @param name The name of the nib file, without any leading path information. + @param bundleOrNil The bundle in which to search for the nib file. If you specify nil, this method looks for the nib file in the main bundle. + @param optionsOrNil A dictionary containing the options to use when opening the nib file. For a list of available keys for this dictionary, see NSBundle UIKit Additions. + */ +- (void)loadWithNibName:(NSString *)name bundle:(nullable NSBundle *)bundleOrNil options:(nullable NSDictionary *)optionsOrNil; + @end /** diff --git a/MXParallaxHeader/MXParallaxHeader.m b/Sources/MXParallaxHeader.m similarity index 61% rename from MXParallaxHeader/MXParallaxHeader.m rename to Sources/MXParallaxHeader.m index 29c79e0..3fc62e1 100644 --- a/MXParallaxHeader/MXParallaxHeader.m +++ b/Sources/MXParallaxHeader.m @@ -1,6 +1,6 @@ // MXParallaxHeader.m // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -49,7 +49,10 @@ - (void)didMoveToSuperview{ @end @interface MXParallaxHeader () -@property (nonatomic,weak) UIScrollView *scrollView; +@property (nonatomic, weak) UIScrollView *scrollView; + +@property (nonatomic, strong) NSLayoutConstraint *positionConstraint; +@property (nonatomic, strong) NSLayoutConstraint *heightConstraint; @end @implementation MXParallaxHeader { @@ -65,6 +68,10 @@ - (UIView *)contentView { MXParallaxView *contentView = [MXParallaxView new]; contentView.parent = self; contentView.clipsToBounds = YES; + contentView.translatesAutoresizingMaskIntoConstraints = NO; + + _heightConstraint = [contentView.heightAnchor constraintEqualToConstant:0]; + _contentView = contentView; } return _contentView; @@ -72,8 +79,16 @@ - (UIView *)contentView { - (void)setView:(UIView *)view { if (view != _view) { + [_view removeFromSuperview]; _view = view; + [self updateConstraints]; + + [self.contentView layoutIfNeeded]; + + self.height = self.contentView.frame.size.height; + self.heightConstraint.constant = self.height; + self.heightConstraint.active = YES; } } @@ -86,12 +101,14 @@ - (void)setMode:(MXParallaxHeaderMode)mode { - (void)setHeight:(CGFloat)height { if (_height != height) { - + //Adjust content inset [self adjustScrollViewTopInset:self.scrollView.contentInset.top - _height + height]; - + _height = height; - [self updateConstraints]; + + self.heightConstraint.constant = height; + self.heightConstraint.active = YES; [self layoutContentView]; } } @@ -104,13 +121,6 @@ - (void)setMinimumHeight:(CGFloat)minimumHeight { - (void)setScrollView:(UIScrollView *)scrollView { if (_scrollView != scrollView) { _scrollView = scrollView; - - //Adjust content inset - [self adjustScrollViewTopInset:scrollView.contentInset.top + self.height]; - [scrollView addSubview:self.contentView]; - - //Layout content view - [self layoutContentView]; _isObserving = YES; } } @@ -118,96 +128,101 @@ - (void)setScrollView:(UIScrollView *)scrollView { - (void)setProgress:(CGFloat)progress { if(_progress != progress) { _progress = progress; - + if ([self.delegate respondsToSelector:@selector(parallaxHeaderDidScroll:)]) { [self.delegate parallaxHeaderDidScroll:self]; } } } +- (void)loadWithNibName:(NSString *)name bundle:(nullable NSBundle *)bundleOrNil options:(nullable NSDictionary *)optionsOrNil { + UINib *nib = [UINib nibWithNibName:name bundle:bundleOrNil]; + [nib instantiateWithOwner:self options:optionsOrNil]; +} + #pragma mark Constraints - (void)updateConstraints { - if (!self.view) { - return; - } - + if (!self.view) return; + + [self.contentView removeFromSuperview]; + [self.scrollView addSubview:self.contentView]; + [self.view removeFromSuperview]; [self.contentView addSubview:self.view]; - + self.view.translatesAutoresizingMaskIntoConstraints = NO; - + switch (self.mode) { case MXParallaxHeaderModeFill: [self setFillModeConstraints]; break; - + case MXParallaxHeaderModeTopFill: [self setTopFillModeConstraints]; break; - + case MXParallaxHeaderModeTop: [self setTopModeConstraints]; break; - + case MXParallaxHeaderModeBottom: [self setBottomModeConstraints]; break; - + default: [self setCenterModeConstraints]; break; } + + [self setContentViewConstraints]; } - (void)setCenterModeConstraints { - - NSDictionary *binding = @{@"v" : self.view}; - [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[v]|" options:0 metrics:nil views:binding]]; - - [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.view - attribute:NSLayoutAttributeCenterY - relatedBy:NSLayoutRelationEqual - toItem:self.contentView - attribute:NSLayoutAttributeCenterY - multiplier:1 - constant:0]]; - - [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.view - attribute:NSLayoutAttributeHeight - relatedBy:NSLayoutRelationEqual - toItem:nil - attribute:NSLayoutAttributeNotAnAttribute - multiplier:1 - constant:self.height]]; + [self.view.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor].active = YES; + [self.view.trailingAnchor constraintEqualToAnchor:self.contentView.trailingAnchor].active = YES; + [self.view.centerYAnchor constraintEqualToAnchor:self.contentView.centerYAnchor].active = YES; + [self.view.heightAnchor constraintEqualToConstant:self.height].active = YES; } - (void)setFillModeConstraints { - NSDictionary *binding = @{@"v" : self.view}; - [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[v]|" options:0 metrics:nil views:binding]]; - [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[v]|" options:0 metrics:nil views:binding]]; + [self.view.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor].active = YES; + [self.view.trailingAnchor constraintEqualToAnchor:self.contentView.trailingAnchor].active = YES; + [self.view.topAnchor constraintEqualToAnchor:self.contentView.topAnchor].active = YES; + [self.view.bottomAnchor constraintEqualToAnchor:self.contentView.bottomAnchor].active = YES; } - (void)setTopFillModeConstraints { - NSDictionary *binding = @{@"v" : self.view}; - NSDictionary *metrics = @{@"highPriority" : @(UILayoutPriorityDefaultHigh), - @"height" : @(self.height)}; - [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[v]|" options:0 metrics:nil views:binding]]; - [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[v(>=height)]-0.0@highPriority-|" options:0 metrics:metrics views:binding]]; + [self.view.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor].active = YES; + [self.view.trailingAnchor constraintEqualToAnchor:self.contentView.trailingAnchor].active = YES; + [self.view.topAnchor constraintEqualToAnchor:self.contentView.topAnchor].active = YES; + [self.view.heightAnchor constraintGreaterThanOrEqualToConstant:self.height].active = YES; + + NSLayoutConstraint *constraint = [self.view.bottomAnchor constraintEqualToAnchor:self.contentView.bottomAnchor]; + constraint.priority = UILayoutPriorityDefaultHigh; + constraint.active = YES; } - (void)setTopModeConstraints { - NSDictionary *binding = @{@"v" : self.view}; - NSDictionary *metrics = @{@"height" : @(self.height)}; - [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[v]|" options:0 metrics:nil views:binding]]; - [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[v(==height)]" options:0 metrics:metrics views:binding]]; + [self.view.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor].active = YES; + [self.view.trailingAnchor constraintEqualToAnchor:self.contentView.trailingAnchor].active = YES; + [self.view.topAnchor constraintEqualToAnchor:self.contentView.topAnchor].active = YES; + [self.view.heightAnchor constraintEqualToConstant:self.height].active = YES; } - (void)setBottomModeConstraints { - NSDictionary *binding = @{@"v" : self.view}; - NSDictionary *metrics = @{@"height" : @(self.height)}; - [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[v]|" options:0 metrics:nil views:binding]]; - [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[v(==height)]|" options:0 metrics:metrics views:binding]]; + [self.view.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor].active = YES; + [self.view.trailingAnchor constraintEqualToAnchor:self.contentView.trailingAnchor].active = YES; + [self.view.bottomAnchor constraintEqualToAnchor:self.contentView.bottomAnchor].active = YES; + [self.view.heightAnchor constraintEqualToConstant:self.height].active = YES; +} + +- (void)setContentViewConstraints { + [self.contentView.leadingAnchor constraintEqualToAnchor:self.scrollView.leadingAnchor].active = YES; + [self.contentView.trailingAnchor constraintEqualToAnchor:self.scrollView.trailingAnchor].active = YES; + + self.positionConstraint = [self.contentView.topAnchor constraintEqualToAnchor:self.scrollView.topAnchor]; + self.positionConstraint.active = YES; } #pragma mark Private Methods @@ -216,28 +231,24 @@ - (void)layoutContentView { CGFloat minimumHeight = MIN(self.minimumHeight, self.height); CGFloat relativeYOffset = self.scrollView.contentOffset.y + self.scrollView.contentInset.top - self.height; CGFloat relativeHeight = -relativeYOffset; - - CGRect frame = (CGRect){ - .origin.x = 0, - .origin.y = relativeYOffset, - .size.width = self.scrollView.frame.size.width, - .size.height = MAX(relativeHeight, minimumHeight) - }; - - self.contentView.frame = frame; - + + self.positionConstraint.constant = relativeYOffset; + self.heightConstraint.constant = MAX(relativeHeight, minimumHeight); + + [self.contentView layoutSubviews]; + CGFloat div = self.height - self.minimumHeight; self.progress = (self.contentView.frame.size.height - self.minimumHeight) / (div? : self.height); } - (void)adjustScrollViewTopInset:(CGFloat)top { UIEdgeInsets inset = self.scrollView.contentInset; - + //Adjust content offset CGPoint offset = self.scrollView.contentOffset; offset.y += inset.top - top; self.scrollView.contentOffset = offset; - + //Adjust content inset inset.top = top; self.scrollView.contentInset = inset; @@ -247,9 +258,8 @@ - (void)adjustScrollViewTopInset:(CGFloat)top { //This is where the magic happens... - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { - + if (context == kMXParallaxHeaderKVOContext) { - if ([keyPath isEqualToString:NSStringFromSelector(@selector(contentOffset))]) { [self layoutContentView]; } diff --git a/MXParallaxHeader/MXScrollView.h b/Sources/MXScrollView.h similarity index 98% rename from MXParallaxHeader/MXScrollView.h rename to Sources/MXScrollView.h index 32eb4c6..76ca0b5 100644 --- a/MXParallaxHeader/MXScrollView.h +++ b/Sources/MXScrollView.h @@ -1,6 +1,6 @@ // MXScrollView.h // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // 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/MXParallaxHeader/MXScrollView.m b/Sources/MXScrollView.m similarity index 94% rename from MXParallaxHeader/MXScrollView.m rename to Sources/MXScrollView.m index ab29a90..59a51b5 100644 --- a/MXParallaxHeader/MXScrollView.m +++ b/Sources/MXScrollView.m @@ -1,6 +1,6 @@ // MXScrollView.m // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -65,10 +65,6 @@ - (void)initialize { self.directionalLockEnabled = YES; self.bounces = YES; - if (@available(iOS 11.0, *)) { - self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; - } - self.panGestureRecognizer.cancelsTouchesInView = NO; self.observedViews = [NSMutableArray array]; @@ -112,17 +108,26 @@ - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecogni return NO; } + UIView *otherView = otherGestureRecognizer.view; + // WKWebView on he MXScrollView + if ([otherView isKindOfClass:NSClassFromString(@"WKContentView")]) { + otherView = otherView.superview; + } // Consider scroll view pan only - if (![otherGestureRecognizer.view isKindOfClass:[UIScrollView class]]) { + if (![otherView isKindOfClass:[UIScrollView class]]) { return NO; } - UIScrollView *scrollView = (id)otherGestureRecognizer.view; + UIScrollView *scrollView = (id)otherView; // Tricky case: UITableViewWrapperView if ([scrollView.superview isKindOfClass:[UITableView class]]) { return NO; } + //tableview on the MXScrollView + if ([scrollView.superview isKindOfClass:NSClassFromString(@"UITableViewCellContentView")]) { + return NO; + } BOOL shouldScroll = YES; if ([self.delegate respondsToSelector:@selector(scrollView:shouldScrollWithSubView:)]) { diff --git a/MXParallaxHeader/MXScrollViewController.h b/Sources/MXScrollViewController.h similarity index 86% rename from MXParallaxHeader/MXScrollViewController.h rename to Sources/MXScrollViewController.h index 0344c1b..36565cc 100644 --- a/MXParallaxHeader/MXScrollViewController.h +++ b/Sources/MXScrollViewController.h @@ -1,6 +1,6 @@ // MXScrollViewController.h // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -32,17 +32,17 @@ NS_ASSUME_NONNULL_BEGIN /** The scroll view container. */ -@property (nonatomic,readonly) MXScrollView *scrollView; +@property (nonatomic, readonly) MXScrollView *scrollView; /** The parallax header view controller to be added to the scroll view. */ -@property (nonatomic,strong,nullable) UIViewController *headerViewController; +@property (nonatomic, strong, nullable) UIViewController *headerViewController; /** The child view controller to be added to the scroll view. */ -@property (nonatomic,strong,nullable) UIViewController *childViewController; +@property (nonatomic, strong, nullable) UIViewController *childViewController; @end @@ -54,7 +54,7 @@ NS_ASSUME_NONNULL_BEGIN /** The parallax header. */ -@property (nonatomic,readonly,nullable) MXParallaxHeader *parallaxHeader; +@property (nonatomic, readonly, nullable) MXParallaxHeader *parallaxHeader; @end diff --git a/MXParallaxHeader/MXScrollViewController.m b/Sources/MXScrollViewController.m similarity index 67% rename from MXParallaxHeader/MXScrollViewController.m rename to Sources/MXScrollViewController.m index d2e4ae7..99f369e 100644 --- a/MXParallaxHeader/MXScrollViewController.m +++ b/Sources/MXScrollViewController.m @@ -1,6 +1,6 @@ // MXScrollViewController.m // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -24,27 +24,35 @@ #import "MXScrollViewController.h" @interface MXScrollViewController () -@property (nonatomic,weak) IBOutlet UIView *headerView; +@property (nonatomic, weak) IBOutlet UIView *headerView; @property (nonatomic) IBInspectable CGFloat headerHeight; @property (nonatomic) IBInspectable CGFloat headerMinimumHeight; +@property (nonatomic, weak) NSLayoutConstraint *childHeightConstraint; @end @implementation MXScrollViewController static void * const kMXScrollViewControllerKVOContext = (void*)&kMXScrollViewControllerKVOContext; -@synthesize scrollView = _scrollView; -- (void)loadView { - self.view = self.scrollView; -} +@synthesize scrollView = _scrollView; +@dynamic headerHeight; +@dynamic headerMinimumHeight; - (void)viewDidLoad { [super viewDidLoad]; - + + self.scrollView.translatesAutoresizingMaskIntoConstraints = NO; + + [self.view addSubview:self.scrollView]; + [self.scrollView.topAnchor constraintEqualToAnchor:self.view.topAnchor].active = YES; + [self.scrollView.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor].active = YES; + [self.scrollView.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor].active = YES; + [self.scrollView.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor].active = YES; + self.scrollView.parallaxHeader.view = self.headerView; self.scrollView.parallaxHeader.height = self.headerHeight; self.scrollView.parallaxHeader.minimumHeight = self.headerMinimumHeight; - + //Hack to perform segues on load @try { NSArray *templates = [self valueForKey:@"storyboardSegueTemplates"]; @@ -57,20 +65,31 @@ - (void)viewDidLoad { } } } - @catch(NSException *exception) {} + @catch(NSException *exception) { + NSLog(@"%@", exception); + } } -- (void)viewDidLayoutSubviews { - [super viewDidLayoutSubviews]; - self.scrollView.contentSize = self.scrollView.frame.size; - [self layoutChildViewController]; +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + + if (@available(iOS 11.0, *)) return; + + if (self.automaticallyAdjustsScrollViewInsets) { + self.headerMinimumHeight = self.topLayoutGuide.length; + } } -- (void)layoutChildViewController { - CGRect frame = self.scrollView.frame; - frame.origin = CGPointZero; - frame.size.height -= self.scrollView.parallaxHeader.minimumHeight; - self.childViewController.view.frame = frame; +- (void)viewSafeAreaInsetsDidChange { + [super viewSafeAreaInsetsDidChange]; + + if (self.scrollView.contentInsetAdjustmentBehavior != UIScrollViewContentInsetAdjustmentNever) { + self.headerMinimumHeight = self.view.safeAreaInsets.top; + + UIEdgeInsets safeAreaInsets = UIEdgeInsetsZero; + safeAreaInsets.bottom = self.view.safeAreaInsets.bottom; + self.childViewController.additionalSafeAreaInsets = safeAreaInsets; + } } #pragma mark Properties @@ -94,14 +113,14 @@ - (void)setHeaderViewController:(UIViewController *)headerViewController { [_headerViewController removeFromParentViewController]; [_headerViewController didMoveToParentViewController:nil]; } - + if (headerViewController) { [headerViewController willMoveToParentViewController:self]; [self addChildViewController:headerViewController]; - + //Set parallaxHeader view objc_setAssociatedObject(headerViewController, @selector(parallaxHeader), self.scrollView.parallaxHeader, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - + self.scrollView.parallaxHeader.view = headerViewController.view; [headerViewController didMoveToParentViewController:self]; } @@ -115,27 +134,59 @@ - (void)setChildViewController:(UIViewController *)childVi [_childViewController removeFromParentViewController]; [_childViewController didMoveToParentViewController:nil]; } - + if (childViewController) { [childViewController willMoveToParentViewController:self]; [self addChildViewController:childViewController]; - - //Set UIViewController's parallaxHeader property + + // Set UIViewController's parallaxHeader property objc_setAssociatedObject(childViewController, @selector(parallaxHeader), self.scrollView.parallaxHeader, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - + [self.scrollView addSubview:childViewController.view]; + + // Set child's constraints + childViewController.view.translatesAutoresizingMaskIntoConstraints = NO; + + [childViewController.view.leadingAnchor constraintEqualToAnchor:self.scrollView.leadingAnchor].active = YES; + [childViewController.view.trailingAnchor constraintEqualToAnchor:self.scrollView.trailingAnchor].active = YES; + [childViewController.view.widthAnchor constraintEqualToAnchor:self.scrollView.widthAnchor].active = YES; + + [childViewController.view.topAnchor constraintEqualToAnchor:self.scrollView.topAnchor].active = YES; + [childViewController.view.bottomAnchor constraintEqualToAnchor:self.scrollView.bottomAnchor].active = YES; + + self.childHeightConstraint = [childViewController.view.heightAnchor constraintEqualToAnchor:self.scrollView.heightAnchor constant:-self.headerMinimumHeight]; + self.childHeightConstraint.active = YES; + [childViewController didMoveToParentViewController:self]; + } _childViewController = childViewController; } +- (void)setHeaderHeight:(CGFloat)headerHeight { + self.scrollView.parallaxHeader.height = headerHeight; +} + +- (CGFloat)headerHeight { + return self.scrollView.parallaxHeader.height; +} + +- (void)setHeaderMinimumHeight:(CGFloat)headerMinimumHeight { + self.childHeightConstraint.constant = -headerMinimumHeight; + self.scrollView.parallaxHeader.minimumHeight = headerMinimumHeight; +} + +- (CGFloat)headerMinimumHeight { + return self.scrollView.parallaxHeader.minimumHeight; +} + #pragma mark KVO - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if (context == kMXScrollViewControllerKVOContext) { if (self.childViewController && [keyPath isEqualToString:NSStringFromSelector(@selector(minimumHeight))]) { - [self layoutChildViewController]; + self.childHeightConstraint.constant = -self.scrollView.parallaxHeader.minimumHeight; } } else { [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; @@ -187,5 +238,3 @@ - (void)perform { } @end - -