├── .gitignore
├── .travis.yml
├── Example
├── FTFoldingPaper.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── FTFoldingPaper-Example.xcscheme
├── FTFoldingPaper.xcworkspace
│ └── contents.xcworkspacedata
├── FTFoldingPaper
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── ExampleTableModel.h
│ ├── ExampleTableModel.m
│ ├── ExampleViewController+CellDisplayedData.h
│ ├── ExampleViewController+CellDisplayedData.m
│ ├── ExampleViewController.h
│ ├── ExampleViewController.m
│ ├── ExcerciseDataModel.h
│ ├── ExcerciseDataModel.m
│ ├── ExerciseFoldComponentData.h
│ ├── ExerciseFoldComponentData.m
│ ├── ExerciseFoldComponentView.h
│ ├── ExerciseFoldComponentView.m
│ ├── ExpandingCellAnimationView.h
│ ├── ExpandingCellAnimationView.m
│ ├── ExpandingTableViewCell.h
│ ├── ExpandingTableViewCell.m
│ ├── ExpandingTableViewCell.xib
│ ├── FTAppDelegate.h
│ ├── FTAppDelegate.m
│ ├── FTFoldingPaper-Info.plist
│ ├── FTFoldingPaper-Prefix.pch
│ ├── FoldComponentBottomLayer.xib
│ ├── FoldComponentTopLayer.xib
│ ├── Images.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── NonExpandingTableViewCell.xib
│ ├── StandardTableViewCell.h
│ ├── StandardTableViewCell.m
│ ├── StandardTableViewCell.xib
│ ├── WeekdayCellData.h
│ ├── WeekdayCellData.m
│ ├── en.lproj
│ │ └── InfoPlist.strings
│ └── main.m
├── Podfile
├── Podfile.lock
├── Pods
│ ├── Local Podspecs
│ │ └── FTFoldingPaper.podspec.json
│ ├── Manifest.lock
│ ├── Pods.xcodeproj
│ │ ├── project.pbxproj
│ │ └── project.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ └── Target Support Files
│ │ ├── FTFoldingPaper
│ │ ├── FTFoldingPaper-dummy.m
│ │ ├── FTFoldingPaper-prefix.pch
│ │ ├── FTFoldingPaper-umbrella.h
│ │ ├── FTFoldingPaper.modulemap
│ │ ├── FTFoldingPaper.xcconfig
│ │ └── Info.plist
│ │ ├── Pods-FTFoldingPaper_Example
│ │ ├── Info.plist
│ │ ├── Pods-FTFoldingPaper_Example-acknowledgements.markdown
│ │ ├── Pods-FTFoldingPaper_Example-acknowledgements.plist
│ │ ├── Pods-FTFoldingPaper_Example-dummy.m
│ │ ├── Pods-FTFoldingPaper_Example-frameworks.sh
│ │ ├── Pods-FTFoldingPaper_Example-resources.sh
│ │ ├── Pods-FTFoldingPaper_Example-umbrella.h
│ │ ├── Pods-FTFoldingPaper_Example.debug.xcconfig
│ │ ├── Pods-FTFoldingPaper_Example.modulemap
│ │ └── Pods-FTFoldingPaper_Example.release.xcconfig
│ │ └── Pods-FTFoldingPaper_Tests
│ │ ├── Info.plist
│ │ ├── Pods-FTFoldingPaper_Tests-acknowledgements.markdown
│ │ ├── Pods-FTFoldingPaper_Tests-acknowledgements.plist
│ │ ├── Pods-FTFoldingPaper_Tests-dummy.m
│ │ ├── Pods-FTFoldingPaper_Tests-frameworks.sh
│ │ ├── Pods-FTFoldingPaper_Tests-resources.sh
│ │ ├── Pods-FTFoldingPaper_Tests-umbrella.h
│ │ ├── Pods-FTFoldingPaper_Tests.debug.xcconfig
│ │ ├── Pods-FTFoldingPaper_Tests.modulemap
│ │ └── Pods-FTFoldingPaper_Tests.release.xcconfig
└── Tests
│ ├── Tests-Info.plist
│ ├── Tests-Prefix.pch
│ ├── Tests.m
│ └── en.lproj
│ └── InfoPlist.strings
├── FTFoldingPaper.podspec
├── FTFoldingPaper
├── Assets
│ └── .gitkeep
└── Classes
│ ├── .gitkeep
│ ├── AnimationContextStructs.h
│ ├── FTAnimationContext+FoldComponentsAnimation.h
│ ├── FTAnimationContext+FoldComponentsAnimation.m
│ ├── FTAnimationContext+GradientColorAnimation.h
│ ├── FTAnimationContext+GradientColorAnimation.m
│ ├── FTAnimationContext.h
│ ├── FTAnimationContext.m
│ ├── FTAnimationView+Tools.h
│ ├── FTAnimationView+Tools.m
│ ├── FTAnimationView.h
│ ├── FTAnimationView.m
│ ├── FTFoldComponent.h
│ ├── FTFoldComponent.m
│ ├── FTFoldComponentAnimations.h
│ ├── FTFoldComponentAnimations.m
│ ├── FTFoldComponentGradientAnimations.h
│ ├── FTFoldComponentGradientAnimations.m
│ ├── FTFoldingPaper.h
│ ├── FTParentLayerAnimations.h
│ ├── FTParentLayerAnimations.m
│ ├── FTTableCell.h
│ ├── FTTableCell.m
│ ├── FTTableCellMetadata.h
│ ├── FTTableCellMetadata.m
│ ├── FTTableCellSeparator.h
│ ├── FTTableCellSeparator.m
│ ├── FTTableModel.h
│ ├── FTTableModel.m
│ ├── FTTableView.h
│ ├── FTTableView.m
│ ├── FTViewController+CellsConfiguration.h
│ ├── FTViewController+CellsConfiguration.m
│ ├── FTViewController.h
│ └── FTViewController.m
├── LICENSE
├── README.md
└── _Pods.xcodeproj
/.gitignore:
--------------------------------------------------------------------------------
1 | # OS X
2 | .DS_Store
3 |
4 | # Xcode
5 | build/
6 | *.pbxuser
7 | !default.pbxuser
8 | *.mode1v3
9 | !default.mode1v3
10 | *.mode2v3
11 | !default.mode2v3
12 | *.perspectivev3
13 | !default.perspectivev3
14 | xcuserdata/
15 | *.xccheckout
16 | profile
17 | *.moved-aside
18 | DerivedData
19 | *.hmap
20 | *.ipa
21 |
22 | # Bundler
23 | .bundle
24 |
25 | Carthage
26 | # We recommend against adding the Pods directory to your .gitignore. However
27 | # you should judge for yourself, the pros and cons are mentioned at:
28 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
29 | #
30 | # Note: if you ignore the Pods directory, make sure to uncomment
31 | # `pod install` in .travis.yml
32 | #
33 | # Pods/
34 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: objective-c
--------------------------------------------------------------------------------
/Example/FTFoldingPaper.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper.xcodeproj/xcshareddata/xcschemes/FTFoldingPaper-Example.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
53 |
54 |
64 |
66 |
72 |
73 |
74 |
75 |
76 |
77 |
83 |
85 |
91 |
92 |
93 |
94 |
96 |
97 |
100 |
101 |
102 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/ExampleTableModel.h:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | #import "FTTableModel.h"
23 |
24 | @interface ExampleTableModel : FTTableModel
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/ExampleTableModel.m:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | #import "ExampleTableModel.h"
23 |
24 | #define kNumberOfCellsInTable 15
25 |
26 | @implementation ExampleTableModel
27 |
28 | -(NSDictionary *)submitCellsIDs{
29 |
30 | return @{@"ExpandingTableViewCellID":@"ExpandingTableViewCell"};
31 |
32 | }
33 |
34 |
35 | /* Submit your table architecture. In this example table consists only from cells of one type.
36 | You can implement any custom architecture, combining different cell types for different table rows */
37 |
38 | -(NSArray *)submitTableCellsMetadata{
39 |
40 | NSMutableArray *cellsMetadata = [[NSMutableArray alloc]init];
41 |
42 | for (NSInteger i = 0; i < kNumberOfCellsInTable; i++) {
43 |
44 | FTTableCellMetadata *tableCellMetadata = nil;
45 |
46 | tableCellMetadata = [[FTTableCellMetadata alloc]initWithReuseID:@"ExpandingTableViewCellID" isExpandable:YES isExpanded:NO];
47 |
48 | [cellsMetadata addObject:tableCellMetadata];
49 | }
50 |
51 | return cellsMetadata;
52 | }
53 |
54 | @end
55 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/ExampleViewController+CellDisplayedData.h:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | #import "ExampleViewController.h"
23 |
24 |
25 |
26 | /*::: ExampleViewController (CellDisplayedData) responsible for cells data->view operations */
27 |
28 | @interface ExampleViewController (CellDisplayedData)
29 |
30 | -(void) updateDisplayedDataOfNonExpandingCell: (UITableViewCell *) nonExpandingCell
31 | exerciseDataModel: (ExcerciseDataModel *) exerciseDataModel
32 | indexPath: (NSIndexPath*) indexPath;
33 |
34 |
35 | -(void) updateDispayedDataOfExpandingCell: (FTTableCell *) expandingCell
36 | exerciseDataModel: (ExcerciseDataModel *) exerciseDataModel
37 | indexPath: (NSIndexPath*) indexPath;
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/ExampleViewController+CellDisplayedData.m:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | #import "ExampleViewController+CellDisplayedData.h"
23 |
24 | #import "ExpandingTableViewCell.h"
25 | #import "ExerciseFoldComponentView.h"
26 |
27 | @implementation ExampleViewController (CellDisplayedData)
28 |
29 | -(void) updateDisplayedDataOfNonExpandingCell: (UITableViewCell *) nonExpandingCell
30 | exerciseDataModel: (ExcerciseDataModel *) exerciseDataModel
31 | indexPath: (NSIndexPath*) indexPath{
32 |
33 | }
34 |
35 |
36 | -(void) updateDispayedDataOfExpandingCell: (FTTableCell *) expandingCell
37 | exerciseDataModel: (ExcerciseDataModel *) exerciseDataModel
38 | indexPath: (NSIndexPath*) indexPath{
39 |
40 | ExpandingTableViewCell *tableCell = (ExpandingTableViewCell*)expandingCell;
41 | WeekdayCellData *cellData = [exerciseDataModel.excerciseData objectAtIndex:indexPath.row];
42 |
43 |
44 | /* set weekDay name*/
45 | tableCell.weekDay.text = cellData.weekDayName;
46 |
47 | /* set fold elements */
48 | ExerciseFoldComponentData *exerciseFoldComponentData = nil;
49 |
50 |
51 | BOOL foldComponentsOfAnimationViewAreNotCreated = tableCell.animationView.foldComponents == nil;
52 | if (foldComponentsOfAnimationViewAreNotCreated)
53 | [tableCell.animationView layoutIfNeeded];
54 |
55 |
56 | for (NSInteger i = 0; i < tableCell.animationView.foldComponents.count; i++) {
57 |
58 | /* get fold component data */
59 | exerciseFoldComponentData = [cellData.cellFoldComponentsData objectAtIndex:i];
60 |
61 | /* get fold component */
62 | FTFoldComponent * foldComponent = [tableCell.animationView.foldComponents objectAtIndex:i];
63 |
64 | /* set fold component subViews*/
65 | ExerciseFoldComponentView *exerciseFoldComponentView = (ExerciseFoldComponentView*)foldComponent.topView;
66 | [self setView:exerciseFoldComponentView withModelData:exerciseFoldComponentData];
67 |
68 | }
69 | }
70 |
71 |
72 | -(void) setView: (ExerciseFoldComponentView *) view withModelData: (ExerciseFoldComponentData *) data{
73 | view.exerciseLoad.text = data.exerciseLoad;
74 | view.exerciseName.text = data.exerciseName;
75 | view.exerciseLoadColor.backgroundColor = data.exerciseLoadColor;
76 | }
77 |
78 |
79 | @end
80 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/ExampleViewController.h:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | #import "FTViewController.h"
23 | #import "ExcerciseDataModel.h"
24 |
25 | @interface ExampleViewController : FTViewController
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/ExampleViewController.m:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | #import "ExampleViewController.h"
23 |
24 |
25 |
26 | #import "ExampleTableModel.h"
27 | #import "ExampleViewController+CellDisplayedData.h"
28 |
29 |
30 | @interface ExampleViewController ()
31 | @property (weak, nonatomic) IBOutlet FTTableView *tableView;
32 |
33 | @end
34 |
35 | @implementation ExampleViewController{
36 | ExcerciseDataModel *_exerciseDataModel;
37 | }
38 |
39 | #pragma mark -
40 | #pragma mark - Init
41 | -(FTTableModel *)submitTableModel{
42 | return [[ExampleTableModel alloc]init];
43 | }
44 |
45 |
46 | -(FTTableView *)submitTableView{
47 | return self.tableView;
48 | }
49 |
50 |
51 |
52 | #pragma mark -
53 | #pragma mark - Lifecycle
54 |
55 |
56 | -(void)viewDidLoad{
57 | [super viewDidLoad];
58 |
59 | /* to be called once, after tableView is loaded */
60 | /* NOTE: in your project you must ensure that -setupExerciseDataModel and -subscribeToTableCalls are called once per this view controller lifecycle
61 | and if needed delegete -setupExerciseDataModel and -subscribeToTableCalls calls to the object which controlls this controller life cycle e.g parent view controller, etc */
62 | [self setupExerciseDataModel];
63 | [self subscribeToTableCalls];
64 | }
65 |
66 |
67 | -(void) subscribeToTableCalls{
68 | self.tableView.dataSource = self;
69 | self.tableView.delegate = self;
70 | }
71 |
72 |
73 | #pragma mark -
74 | #pragma mark - Calls from UITableView
75 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
76 | return [super tableView:tableView numberOfRowsInSection:section];
77 | }
78 |
79 |
80 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
81 | return [super tableView:tableView cellForRowAtIndexPath:indexPath];
82 | }
83 |
84 |
85 | -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
86 | return [super tableView:tableView heightForRowAtIndexPath:indexPath];
87 | }
88 |
89 |
90 | -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
91 | [self updateDisplayedDataForCell:cell atIndexPath:indexPath];
92 | }
93 |
94 |
95 |
96 |
97 | #pragma mark -
98 | #pragma mark - Exercise Data Model
99 | -(void) setupExerciseDataModel{
100 | _exerciseDataModel = [[ExcerciseDataModel alloc]init];
101 | }
102 |
103 |
104 | -(void) updateDisplayedDataForCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath{
105 |
106 | FTTableCellMetadata *tableCellMetadata = [super tableCellMetadataForRowAtIndex:indexPath];
107 |
108 | if (tableCellMetadata.isExpandable)
109 | [self updateDispayedDataOfExpandingCell:(FTTableCell*)cell exerciseDataModel:_exerciseDataModel indexPath:indexPath];
110 |
111 | else
112 | [self updateDisplayedDataOfNonExpandingCell:cell exerciseDataModel:_exerciseDataModel indexPath:indexPath];
113 |
114 | }
115 |
116 |
117 |
118 |
119 |
120 | @end
121 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/ExcerciseDataModel.h:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | #import
23 | #import "WeekdayCellData.h"
24 | #import "ExerciseFoldComponentData.h"
25 |
26 | @interface ExcerciseDataModel : NSObject
27 |
28 |
29 | @property (nonatomic) NSMutableArray *excerciseData;
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/ExcerciseDataModel.m:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | #import "ExcerciseDataModel.h"
23 |
24 |
25 |
26 | #define kDataSourceSize 15
27 | #define kNumberOfFoldComponentLayers 2
28 |
29 | @implementation ExcerciseDataModel{
30 |
31 | NSArray *_exerciseLoadValues;
32 | NSArray *_exerciseNameValues;
33 | NSArray *_exerciseLoadColorValues;
34 | NSArray *_randomWeekDays;
35 | }
36 |
37 | - (instancetype)init
38 | {
39 | self = [super init];
40 | if (self) {
41 | self.excerciseData = [[NSMutableArray alloc]init];
42 | [self populateValuesPools];
43 | [self populateDataModelWithRandomValues];
44 | }
45 | return self;
46 | }
47 |
48 |
49 |
50 |
51 |
52 | -(void) populateValuesPools{
53 |
54 | _exerciseLoadValues = @[@"5 x 12",@"3 x 8",@"3 x 5",@"1 x 7",@"6 x 10",@" 2 x 7", @"5 x 5"];
55 |
56 |
57 | _exerciseNameValues = @[@"45 Degree Side Crunch",
58 | @"Ab Crunch Machine",
59 | @"Elevated Legs",
60 | @"Crunch, Side",
61 | @"Dumbbell Flyes",
62 | @"Inclined Bench",
63 | @"Bicep Barbell",
64 | @"Curl Bar",
65 | @"Concentration",
66 | @"Forearm Curl",
67 | @"Hammer Curl"];
68 |
69 |
70 | _exerciseLoadColorValues = @[[UIColor colorWithRed:255.0f/255.0f green:220.0f/255.0f blue:7.0f/255.0f alpha:1.0f],
71 | [UIColor colorWithRed:254.0f/255.0f green:126.0f/255.0f blue:174.0f/255.0f alpha:1.0f],
72 | [UIColor colorWithRed:218.0f/255.0f green:133.0f/255.0f blue:216.0f/255.0f alpha:1.0f],
73 | [UIColor colorWithRed:175.0f/255.0f green:255.0f/255.0f blue:0.0f/255.0f alpha:1.0f]];
74 |
75 |
76 | _randomWeekDays = [self randomWeekDays];
77 | }
78 |
79 |
80 |
81 |
82 |
83 | -(void)populateDataModelWithRandomValues{
84 |
85 | for (NSInteger i = 0; i < kDataSourceSize; i++)
86 | [self.excerciseData addObject:[self randomWeekdayCellDataWithRandomDayIndex:i]];
87 |
88 | }
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 | #pragma mark -
97 | #pragma mark - Randomisation tools
98 |
99 | -(WeekdayCellData *) randomWeekdayCellDataWithRandomDayIndex:(NSInteger) randomDayIndex{
100 |
101 | WeekdayCellData *weekdayCellData = [[WeekdayCellData alloc]init];
102 | weekdayCellData.weekDayName = [_randomWeekDays objectAtIndex:randomDayIndex];
103 | weekdayCellData.cellFoldComponentsData = [self randomCellFoldComponents];
104 |
105 | return weekdayCellData;
106 | }
107 |
108 |
109 | -(NSArray*) randomCellFoldComponents{
110 |
111 | NSMutableArray *randomCellFoldComponents = [[NSMutableArray alloc]init];
112 |
113 | for (NSInteger i = 0; i < kNumberOfFoldComponentLayers; i++)
114 | [randomCellFoldComponents addObject:[self randomFoldComponentData]];
115 |
116 | return randomCellFoldComponents;
117 | }
118 |
119 |
120 | -(ExerciseFoldComponentData*) randomFoldComponentData{
121 |
122 | NSString *randomExerciseLoad = [self randomObjectFromArray:_exerciseLoadValues];
123 | UIColor *randomExcerciseLoadColor = [self randomObjectFromArray:_exerciseLoadColorValues];
124 | NSString *randomExerciseName = [self randomObjectFromArray:_exerciseNameValues];
125 |
126 | return [[ExerciseFoldComponentData alloc]initWithExerciseLoad:randomExerciseLoad
127 | exerciseLoadColor:randomExcerciseLoadColor
128 | exerciseName:randomExerciseName];
129 | }
130 |
131 | -(id) randomObjectFromArray: (NSArray*) array{
132 | return [array objectAtIndex:arc4random() % array.count];
133 | }
134 |
135 |
136 | -(NSArray*) randomWeekDays{
137 |
138 | NSArray *weekDays = @[@"MONDAY",@"TUESDAY",@"WEDNESDAY",@"THURSDAY",@"FRIDAY",@"SATURDAY",@"SUNDAY"];
139 | NSMutableArray *randomWeekDays = [[NSMutableArray alloc]initWithCapacity:kDataSourceSize];
140 | NSInteger randomFirstWeekDay = arc4random() % 6;
141 |
142 |
143 | for (NSInteger i = 0; i < kDataSourceSize; i++){
144 |
145 | switch (i) {
146 |
147 | case 0:
148 | [randomWeekDays addObject:@"TODAY"];
149 | break;
150 |
151 | case 1:
152 | [randomWeekDays addObject:@"TOMORROW"];
153 | break;
154 |
155 | default:
156 |
157 | if (randomFirstWeekDay == weekDays.count) randomFirstWeekDay = 0;
158 | [randomWeekDays addObject:[weekDays objectAtIndex:randomFirstWeekDay]];
159 | randomFirstWeekDay++;
160 | break;
161 | }
162 | }
163 |
164 | return randomWeekDays;
165 | }
166 |
167 |
168 |
169 |
170 | @end
171 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/ExerciseFoldComponentData.h:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | #import
23 | #import
24 |
25 | @interface ExerciseFoldComponentData : NSObject
26 |
27 | -(instancetype) initWithExerciseLoad: (NSString *) exerciseLoad
28 | exerciseLoadColor: (UIColor *) exerciseLoadColor
29 | exerciseName: (NSString *) exerciseName;
30 |
31 | @property (nonatomic) NSString *exerciseLoad;
32 | @property (nonatomic) UIColor *exerciseLoadColor;
33 | @property (nonatomic) NSString *exerciseName;
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/ExerciseFoldComponentData.m:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | #import "ExerciseFoldComponentData.h"
23 |
24 | @implementation ExerciseFoldComponentData
25 |
26 |
27 | -(instancetype) initWithExerciseLoad: (NSString *) exerciseLoad
28 | exerciseLoadColor: (UIColor *) exerciseLoadColor
29 | exerciseName: (NSString *) exerciseName{
30 | self = [super init];
31 | if (self) {
32 | self.exerciseLoad = exerciseLoad;
33 | self.exerciseLoadColor = exerciseLoadColor;
34 | self.exerciseName = exerciseName;
35 |
36 | }
37 | return self;
38 | }
39 |
40 |
41 | @end
42 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/ExerciseFoldComponentView.h:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | #import
23 |
24 |
25 | @interface ExerciseFoldComponentView : UIView
26 |
27 | @property (weak, nonatomic) IBOutlet UILabel *exerciseLoad;
28 | @property (weak, nonatomic) IBOutlet UIView *exerciseLoadColor;
29 | @property (weak, nonatomic) IBOutlet UILabel *exerciseName;
30 |
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/ExerciseFoldComponentView.m:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | #import "ExerciseFoldComponentView.h"
23 |
24 |
25 | @implementation ExerciseFoldComponentView
26 |
27 |
28 | - (instancetype)initWithFrame:(CGRect)frame
29 | {
30 | self = [super initWithFrame:frame];
31 | if (self) {
32 |
33 | self.exerciseLoadColor.layer.allowsEdgeAntialiasing = YES;
34 |
35 | }
36 | return self;
37 | }
38 |
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/ExpandingCellAnimationView.h:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | #import "FTAnimationView.h"
23 |
24 | @interface ExpandingCellAnimationView : FTAnimationView
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/ExpandingCellAnimationView.m:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | #import "ExpandingCellAnimationView.h"
23 |
24 | @implementation ExpandingCellAnimationView
25 |
26 | -(NSArray *)submitFoldComponents{
27 |
28 | /* example of animation view with 2 fold components*/
29 |
30 | FTFoldComponent *foldComponentA = [[FTFoldComponent alloc]initWithSuperView:self
31 | topViewNibName:@"FoldComponentTopLayer"
32 | bottomViewNibName:@"FoldComponentTopLayer"];
33 |
34 | FTFoldComponent *foldComponentB = [[FTFoldComponent alloc]initWithSuperView:self
35 | topViewNibName:@"FoldComponentTopLayer"
36 | bottomViewNibName:@"FoldComponentBottomLayer"];
37 |
38 |
39 | return @[foldComponentA,foldComponentB];
40 | }
41 |
42 |
43 | -(void)configureAnimationContext:(FTAnimationContext *)animationContext{
44 |
45 | /* please refer to FTAnimationContext interface to get the
46 | full list of possible configuration parameters */
47 |
48 | animationContext.expandAnimationDuration = 0.6f;
49 | animationContext.collapseAnimationDuration = 0.6f;
50 | animationContext.foldAngleFinalValue = - M_PI/6;
51 | animationContext.animationMediaTimingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
52 | }
53 |
54 |
55 |
56 |
57 |
58 |
59 | @end
60 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/ExpandingTableViewCell.h:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | #import "FTTableCell.h"
23 |
24 | @interface ExpandingTableViewCell : FTTableCell
25 |
26 | @property (weak, nonatomic) IBOutlet UILabel *weekDay;
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/ExpandingTableViewCell.m:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | #import "ExpandingTableViewCell.h"
23 | #import "ExpandingCellAnimationView.h"
24 |
25 |
26 |
27 |
28 | @implementation ExpandingTableViewCell
29 |
30 |
31 | -(FTAnimationView *)submitAnimationView{
32 |
33 | return [[ExpandingCellAnimationView alloc]init];
34 | }
35 |
36 |
37 | /* do not override if you need cell without separator */
38 | -(FTTableCellSeparator *)submitCellSeparator{
39 | return [[FTTableCellSeparator alloc]initWithHeight:1.0f
40 | offsetFromCellLeftEdge:0.0f
41 | offsetFromCellRightEdge:0.0f
42 | color:[UIColor colorWithRed:92.0f/255.0f green:94.0f/255.0f blue:102.0f/255.0f alpha:0.1f]];
43 | }
44 |
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/ExpandingTableViewCell.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/FTAppDelegate.h:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | @import UIKit;
23 |
24 | @interface FTAppDelegate : UIResponder
25 |
26 | @property (strong, nonatomic) UIWindow *window;
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/FTAppDelegate.m:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | #import "FTAppDelegate.h"
23 |
24 | @implementation FTAppDelegate
25 |
26 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
27 | {
28 | // Override point for customization after application launch.
29 | return YES;
30 | }
31 |
32 | - (void)applicationWillResignActive:(UIApplication *)application
33 | {
34 | // 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.
35 | // 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.
36 | }
37 |
38 | - (void)applicationDidEnterBackground:(UIApplication *)application
39 | {
40 | // 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.
41 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
42 | }
43 |
44 | - (void)applicationWillEnterForeground:(UIApplication *)application
45 | {
46 | // 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.
47 | }
48 |
49 | - (void)applicationDidBecomeActive:(UIApplication *)application
50 | {
51 | // 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.
52 | }
53 |
54 | - (void)applicationWillTerminate:(UIApplication *)application
55 | {
56 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
57 | }
58 |
59 | @end
60 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/FTFoldingPaper-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | ${PRODUCT_NAME}
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 0.1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 0.1.0
25 | LSRequiresIPhoneOS
26 |
27 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIMainStoryboardFile
30 | Main
31 | UIRequiredDeviceCapabilities
32 |
33 | armv7
34 |
35 | UISupportedInterfaceOrientations
36 |
37 | UIInterfaceOrientationPortrait
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/FTFoldingPaper-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header
3 | //
4 | // The contents of this file are implicitly included at the beginning of every source file.
5 | //
6 |
7 | #import
8 |
9 | #ifndef __IPHONE_5_0
10 | #warning "This project uses features only available in iOS SDK 5.0 and later."
11 | #endif
12 |
13 | #ifdef __OBJC__
14 | @import UIKit;
15 | @import Foundation;
16 | #endif
17 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/FoldComponentBottomLayer.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/FoldComponentTopLayer.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
29 |
30 |
31 |
32 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "20x20",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "20x20",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "29x29",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "29x29",
61 | "scale" : "2x"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "size" : "40x40",
66 | "scale" : "1x"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "size" : "40x40",
71 | "scale" : "2x"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "size" : "76x76",
76 | "scale" : "1x"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "size" : "76x76",
81 | "scale" : "2x"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "size" : "83.5x83.5",
86 | "scale" : "2x"
87 | }
88 | ],
89 | "info" : {
90 | "version" : 1,
91 | "author" : "xcode"
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/NonExpandingTableViewCell.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/StandardTableViewCell.h:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | #import
23 |
24 | @interface StandardTableViewCell : UITableViewCell
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/StandardTableViewCell.m:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | #import "StandardTableViewCell.h"
23 |
24 | @implementation StandardTableViewCell
25 |
26 | - (void)awakeFromNib {
27 | [super awakeFromNib];
28 |
29 | }
30 |
31 |
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/StandardTableViewCell.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/WeekdayCellData.h:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | #import
23 | #import
24 |
25 | @interface WeekdayCellData : NSObject
26 |
27 |
28 | @property (nonatomic) NSString *weekDayName;
29 | @property (nonatomic) NSArray *cellFoldComponentsData;
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/WeekdayCellData.m:
--------------------------------------------------------------------------------
1 | /*Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 |
22 | #import "WeekdayCellData.h"
23 |
24 | @implementation WeekdayCellData
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/Example/FTFoldingPaper/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // FTFoldingPaper
4 | //
5 | // Created by monofire on 05/27/2017.
6 | // Copyright (c) 2017 monofire. All rights reserved.
7 | //
8 |
9 | @import UIKit;
10 | #import "FTAppDelegate.h"
11 |
12 | int main(int argc, char * argv[])
13 | {
14 | @autoreleasepool {
15 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([FTAppDelegate class]));
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Example/Podfile:
--------------------------------------------------------------------------------
1 | use_frameworks!
2 |
3 | target 'FTFoldingPaper_Example' do
4 | pod 'FTFoldingPaper', :path => '../'
5 |
6 | target 'FTFoldingPaper_Tests' do
7 | inherit! :search_paths
8 |
9 |
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/Example/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - FTFoldingPaper (0.1.0)
3 |
4 | DEPENDENCIES:
5 | - FTFoldingPaper (from `../`)
6 |
7 | EXTERNAL SOURCES:
8 | FTFoldingPaper:
9 | :path: ../
10 |
11 | SPEC CHECKSUMS:
12 | FTFoldingPaper: d1e305b5a213f99a859c46910c1ba751acb2c67e
13 |
14 | PODFILE CHECKSUM: d11b17930e5a0681d7dfc751c5f8e887c8f67a72
15 |
16 | COCOAPODS: 1.2.1
17 |
--------------------------------------------------------------------------------
/Example/Pods/Local Podspecs/FTFoldingPaper.podspec.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "FTFoldingPaper",
3 | "version": "0.1.0",
4 | "summary": "UI framework to emulate paper folding effects.",
5 | "description": "FTFoldingPaper is a UI framework built on top of the Core Animation. \nIt is designed to emulate paper folding effects and can be integrated with \nUITableView, used independently or paired with other UI components.",
6 | "homepage": "https://github.com/monofire/FTFoldingPaper",
7 | "license": {
8 | "type": "MIT",
9 | "file": "LICENSE"
10 | },
11 | "authors": {
12 | "monofire": "monofirehub@gmail.com"
13 | },
14 | "source": {
15 | "git": "https://github.com/monofire/FTFoldingPaper.git",
16 | "tag": "0.1.0"
17 | },
18 | "platforms": {
19 | "ios": "8.3"
20 | },
21 | "source_files": "FTFoldingPaper/**/*"
22 | }
23 |
--------------------------------------------------------------------------------
/Example/Pods/Manifest.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - FTFoldingPaper (0.1.0)
3 |
4 | DEPENDENCIES:
5 | - FTFoldingPaper (from `../`)
6 |
7 | EXTERNAL SOURCES:
8 | FTFoldingPaper:
9 | :path: ../
10 |
11 | SPEC CHECKSUMS:
12 | FTFoldingPaper: d1e305b5a213f99a859c46910c1ba751acb2c67e
13 |
14 | PODFILE CHECKSUM: d11b17930e5a0681d7dfc751c5f8e887c8f67a72
15 |
16 | COCOAPODS: 1.2.1
17 |
--------------------------------------------------------------------------------
/Example/Pods/Pods.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/FTFoldingPaper/FTFoldingPaper-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_FTFoldingPaper : NSObject
3 | @end
4 | @implementation PodsDummy_FTFoldingPaper
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/FTFoldingPaper/FTFoldingPaper-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/FTFoldingPaper/FTFoldingPaper-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 | #import "AnimationContextStructs.h"
14 | #import "FTAnimationContext+FoldComponentsAnimation.h"
15 | #import "FTAnimationContext+GradientColorAnimation.h"
16 | #import "FTAnimationContext.h"
17 | #import "FTAnimationView+Tools.h"
18 | #import "FTAnimationView.h"
19 | #import "FTFoldComponent.h"
20 | #import "FTFoldComponentAnimations.h"
21 | #import "FTFoldComponentGradientAnimations.h"
22 | #import "FTFoldingPaper.h"
23 | #import "FTParentLayerAnimations.h"
24 | #import "FTTableCell.h"
25 | #import "FTTableCellMetadata.h"
26 | #import "FTTableCellSeparator.h"
27 | #import "FTTableModel.h"
28 | #import "FTTableView.h"
29 | #import "FTViewController+CellsConfiguration.h"
30 | #import "FTViewController.h"
31 |
32 | FOUNDATION_EXPORT double FTFoldingPaperVersionNumber;
33 | FOUNDATION_EXPORT const unsigned char FTFoldingPaperVersionString[];
34 |
35 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/FTFoldingPaper/FTFoldingPaper.modulemap:
--------------------------------------------------------------------------------
1 | framework module FTFoldingPaper {
2 | umbrella header "FTFoldingPaper-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/FTFoldingPaper/FTFoldingPaper.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/FTFoldingPaper
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
4 | PODS_BUILD_DIR = $BUILD_DIR
5 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
6 | PODS_ROOT = ${SRCROOT}
7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../..
8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
9 | SKIP_INSTALL = YES
10 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/FTFoldingPaper/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 0.1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FTFoldingPaper_Example/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FTFoldingPaper_Example/Pods-FTFoldingPaper_Example-acknowledgements.markdown:
--------------------------------------------------------------------------------
1 | # Acknowledgements
2 | This application makes use of the following third party libraries:
3 |
4 | ## FTFoldingPaper
5 |
6 | Copyright (c) 2017 monofire
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining a copy
9 | of this software and associated documentation files (the "Software"), to deal
10 | in the Software without restriction, including without limitation the rights
11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | copies of the Software, and to permit persons to whom the Software is
13 | furnished to do so, subject to the following conditions:
14 |
15 | The above copyright notice and this permission notice shall be included in
16 | all copies or substantial portions of the Software.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | THE SOFTWARE.
25 |
26 | Generated by CocoaPods - https://cocoapods.org
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FTFoldingPaper_Example/Pods-FTFoldingPaper_Example-acknowledgements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreferenceSpecifiers
6 |
7 |
8 | FooterText
9 | This application makes use of the following third party libraries:
10 | Title
11 | Acknowledgements
12 | Type
13 | PSGroupSpecifier
14 |
15 |
16 | FooterText
17 | Copyright (c) 2017 monofire <monofirehub@gmail.com>
18 |
19 | Permission is hereby granted, free of charge, to any person obtaining a copy
20 | of this software and associated documentation files (the "Software"), to deal
21 | in the Software without restriction, including without limitation the rights
22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23 | copies of the Software, and to permit persons to whom the Software is
24 | furnished to do so, subject to the following conditions:
25 |
26 | The above copyright notice and this permission notice shall be included in
27 | all copies or substantial portions of the Software.
28 |
29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
35 | THE SOFTWARE.
36 |
37 | License
38 | MIT
39 | Title
40 | FTFoldingPaper
41 | Type
42 | PSGroupSpecifier
43 |
44 |
45 | FooterText
46 | Generated by CocoaPods - https://cocoapods.org
47 | Title
48 |
49 | Type
50 | PSGroupSpecifier
51 |
52 |
53 | StringsTable
54 | Acknowledgements
55 | Title
56 | Acknowledgements
57 |
58 |
59 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FTFoldingPaper_Example/Pods-FTFoldingPaper_Example-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_FTFoldingPaper_Example : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_FTFoldingPaper_Example
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FTFoldingPaper_Example/Pods-FTFoldingPaper_Example-frameworks.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
6 |
7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
8 |
9 | install_framework()
10 | {
11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
12 | local source="${BUILT_PRODUCTS_DIR}/$1"
13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
15 | elif [ -r "$1" ]; then
16 | local source="$1"
17 | fi
18 |
19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
20 |
21 | if [ -L "${source}" ]; then
22 | echo "Symlinked..."
23 | source="$(readlink "${source}")"
24 | fi
25 |
26 | # use filter instead of exclude so missing patterns dont' throw errors
27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
29 |
30 | local basename
31 | basename="$(basename -s .framework "$1")"
32 | binary="${destination}/${basename}.framework/${basename}"
33 | if ! [ -r "$binary" ]; then
34 | binary="${destination}/${basename}"
35 | fi
36 |
37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device
38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
39 | strip_invalid_archs "$binary"
40 | fi
41 |
42 | # Resign the code if required by the build settings to avoid unstable apps
43 | code_sign_if_enabled "${destination}/$(basename "$1")"
44 |
45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
47 | local swift_runtime_libs
48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
49 | for lib in $swift_runtime_libs; do
50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
52 | code_sign_if_enabled "${destination}/${lib}"
53 | done
54 | fi
55 | }
56 |
57 | # Signs a framework with the provided identity
58 | code_sign_if_enabled() {
59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
60 | # Use the current code_sign_identitiy
61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
62 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'"
63 |
64 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
65 | code_sign_cmd="$code_sign_cmd &"
66 | fi
67 | echo "$code_sign_cmd"
68 | eval "$code_sign_cmd"
69 | fi
70 | }
71 |
72 | # Strip invalid architectures
73 | strip_invalid_archs() {
74 | binary="$1"
75 | # Get architectures for current file
76 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
77 | stripped=""
78 | for arch in $archs; do
79 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
80 | # Strip non-valid architectures in-place
81 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1
82 | stripped="$stripped $arch"
83 | fi
84 | done
85 | if [[ "$stripped" ]]; then
86 | echo "Stripped $binary of architectures:$stripped"
87 | fi
88 | }
89 |
90 |
91 | if [[ "$CONFIGURATION" == "Debug" ]]; then
92 | install_framework "$BUILT_PRODUCTS_DIR/FTFoldingPaper/FTFoldingPaper.framework"
93 | fi
94 | if [[ "$CONFIGURATION" == "Release" ]]; then
95 | install_framework "$BUILT_PRODUCTS_DIR/FTFoldingPaper/FTFoldingPaper.framework"
96 | fi
97 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
98 | wait
99 | fi
100 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FTFoldingPaper_Example/Pods-FTFoldingPaper_Example-resources.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
5 |
6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
7 | > "$RESOURCES_TO_COPY"
8 |
9 | XCASSET_FILES=()
10 |
11 | case "${TARGETED_DEVICE_FAMILY}" in
12 | 1,2)
13 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
14 | ;;
15 | 1)
16 | TARGET_DEVICE_ARGS="--target-device iphone"
17 | ;;
18 | 2)
19 | TARGET_DEVICE_ARGS="--target-device ipad"
20 | ;;
21 | 3)
22 | TARGET_DEVICE_ARGS="--target-device tv"
23 | ;;
24 | 4)
25 | TARGET_DEVICE_ARGS="--target-device watch"
26 | ;;
27 | *)
28 | TARGET_DEVICE_ARGS="--target-device mac"
29 | ;;
30 | esac
31 |
32 | install_resource()
33 | {
34 | if [[ "$1" = /* ]] ; then
35 | RESOURCE_PATH="$1"
36 | else
37 | RESOURCE_PATH="${PODS_ROOT}/$1"
38 | fi
39 | if [[ ! -e "$RESOURCE_PATH" ]] ; then
40 | cat << EOM
41 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script.
42 | EOM
43 | exit 1
44 | fi
45 | case $RESOURCE_PATH in
46 | *.storyboard)
47 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
48 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
49 | ;;
50 | *.xib)
51 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
52 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
53 | ;;
54 | *.framework)
55 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
56 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
57 | echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
58 | rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
59 | ;;
60 | *.xcdatamodel)
61 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\""
62 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
63 | ;;
64 | *.xcdatamodeld)
65 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\""
66 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
67 | ;;
68 | *.xcmappingmodel)
69 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\""
70 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
71 | ;;
72 | *.xcassets)
73 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH"
74 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
75 | ;;
76 | *)
77 | echo "$RESOURCE_PATH"
78 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
79 | ;;
80 | esac
81 | }
82 |
83 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
84 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
85 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
86 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
87 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
88 | fi
89 | rm -f "$RESOURCES_TO_COPY"
90 |
91 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
92 | then
93 | # Find all other xcassets (this unfortunately includes those of path pods and other targets).
94 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
95 | while read line; do
96 | if [[ $line != "${PODS_ROOT}*" ]]; then
97 | XCASSET_FILES+=("$line")
98 | fi
99 | done <<<"$OTHER_XCASSETS"
100 |
101 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
102 | fi
103 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FTFoldingPaper_Example/Pods-FTFoldingPaper_Example-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
14 | FOUNDATION_EXPORT double Pods_FTFoldingPaper_ExampleVersionNumber;
15 | FOUNDATION_EXPORT const unsigned char Pods_FTFoldingPaper_ExampleVersionString[];
16 |
17 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FTFoldingPaper_Example/Pods-FTFoldingPaper_Example.debug.xcconfig:
--------------------------------------------------------------------------------
1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/FTFoldingPaper"
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/FTFoldingPaper/FTFoldingPaper.framework/Headers"
5 | OTHER_LDFLAGS = $(inherited) -framework "FTFoldingPaper"
6 | PODS_BUILD_DIR = $BUILD_DIR
7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
9 | PODS_ROOT = ${SRCROOT}/Pods
10 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FTFoldingPaper_Example/Pods-FTFoldingPaper_Example.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods_FTFoldingPaper_Example {
2 | umbrella header "Pods-FTFoldingPaper_Example-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FTFoldingPaper_Example/Pods-FTFoldingPaper_Example.release.xcconfig:
--------------------------------------------------------------------------------
1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/FTFoldingPaper"
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/FTFoldingPaper/FTFoldingPaper.framework/Headers"
5 | OTHER_LDFLAGS = $(inherited) -framework "FTFoldingPaper"
6 | PODS_BUILD_DIR = $BUILD_DIR
7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
9 | PODS_ROOT = ${SRCROOT}/Pods
10 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FTFoldingPaper_Tests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FTFoldingPaper_Tests/Pods-FTFoldingPaper_Tests-acknowledgements.markdown:
--------------------------------------------------------------------------------
1 | # Acknowledgements
2 | This application makes use of the following third party libraries:
3 | Generated by CocoaPods - https://cocoapods.org
4 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FTFoldingPaper_Tests/Pods-FTFoldingPaper_Tests-acknowledgements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreferenceSpecifiers
6 |
7 |
8 | FooterText
9 | This application makes use of the following third party libraries:
10 | Title
11 | Acknowledgements
12 | Type
13 | PSGroupSpecifier
14 |
15 |
16 | FooterText
17 | Generated by CocoaPods - https://cocoapods.org
18 | Title
19 |
20 | Type
21 | PSGroupSpecifier
22 |
23 |
24 | StringsTable
25 | Acknowledgements
26 | Title
27 | Acknowledgements
28 |
29 |
30 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FTFoldingPaper_Tests/Pods-FTFoldingPaper_Tests-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_FTFoldingPaper_Tests : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_FTFoldingPaper_Tests
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FTFoldingPaper_Tests/Pods-FTFoldingPaper_Tests-frameworks.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
6 |
7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
8 |
9 | install_framework()
10 | {
11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
12 | local source="${BUILT_PRODUCTS_DIR}/$1"
13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
15 | elif [ -r "$1" ]; then
16 | local source="$1"
17 | fi
18 |
19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
20 |
21 | if [ -L "${source}" ]; then
22 | echo "Symlinked..."
23 | source="$(readlink "${source}")"
24 | fi
25 |
26 | # use filter instead of exclude so missing patterns dont' throw errors
27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
29 |
30 | local basename
31 | basename="$(basename -s .framework "$1")"
32 | binary="${destination}/${basename}.framework/${basename}"
33 | if ! [ -r "$binary" ]; then
34 | binary="${destination}/${basename}"
35 | fi
36 |
37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device
38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
39 | strip_invalid_archs "$binary"
40 | fi
41 |
42 | # Resign the code if required by the build settings to avoid unstable apps
43 | code_sign_if_enabled "${destination}/$(basename "$1")"
44 |
45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
47 | local swift_runtime_libs
48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
49 | for lib in $swift_runtime_libs; do
50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
52 | code_sign_if_enabled "${destination}/${lib}"
53 | done
54 | fi
55 | }
56 |
57 | # Signs a framework with the provided identity
58 | code_sign_if_enabled() {
59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
60 | # Use the current code_sign_identitiy
61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
62 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'"
63 |
64 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
65 | code_sign_cmd="$code_sign_cmd &"
66 | fi
67 | echo "$code_sign_cmd"
68 | eval "$code_sign_cmd"
69 | fi
70 | }
71 |
72 | # Strip invalid architectures
73 | strip_invalid_archs() {
74 | binary="$1"
75 | # Get architectures for current file
76 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
77 | stripped=""
78 | for arch in $archs; do
79 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
80 | # Strip non-valid architectures in-place
81 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1
82 | stripped="$stripped $arch"
83 | fi
84 | done
85 | if [[ "$stripped" ]]; then
86 | echo "Stripped $binary of architectures:$stripped"
87 | fi
88 | }
89 |
90 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
91 | wait
92 | fi
93 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FTFoldingPaper_Tests/Pods-FTFoldingPaper_Tests-resources.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
5 |
6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
7 | > "$RESOURCES_TO_COPY"
8 |
9 | XCASSET_FILES=()
10 |
11 | case "${TARGETED_DEVICE_FAMILY}" in
12 | 1,2)
13 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
14 | ;;
15 | 1)
16 | TARGET_DEVICE_ARGS="--target-device iphone"
17 | ;;
18 | 2)
19 | TARGET_DEVICE_ARGS="--target-device ipad"
20 | ;;
21 | 3)
22 | TARGET_DEVICE_ARGS="--target-device tv"
23 | ;;
24 | 4)
25 | TARGET_DEVICE_ARGS="--target-device watch"
26 | ;;
27 | *)
28 | TARGET_DEVICE_ARGS="--target-device mac"
29 | ;;
30 | esac
31 |
32 | install_resource()
33 | {
34 | if [[ "$1" = /* ]] ; then
35 | RESOURCE_PATH="$1"
36 | else
37 | RESOURCE_PATH="${PODS_ROOT}/$1"
38 | fi
39 | if [[ ! -e "$RESOURCE_PATH" ]] ; then
40 | cat << EOM
41 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script.
42 | EOM
43 | exit 1
44 | fi
45 | case $RESOURCE_PATH in
46 | *.storyboard)
47 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
48 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
49 | ;;
50 | *.xib)
51 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
52 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
53 | ;;
54 | *.framework)
55 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
56 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
57 | echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
58 | rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
59 | ;;
60 | *.xcdatamodel)
61 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\""
62 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
63 | ;;
64 | *.xcdatamodeld)
65 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\""
66 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
67 | ;;
68 | *.xcmappingmodel)
69 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\""
70 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
71 | ;;
72 | *.xcassets)
73 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH"
74 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
75 | ;;
76 | *)
77 | echo "$RESOURCE_PATH"
78 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
79 | ;;
80 | esac
81 | }
82 |
83 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
84 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
85 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
86 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
87 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
88 | fi
89 | rm -f "$RESOURCES_TO_COPY"
90 |
91 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
92 | then
93 | # Find all other xcassets (this unfortunately includes those of path pods and other targets).
94 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
95 | while read line; do
96 | if [[ $line != "${PODS_ROOT}*" ]]; then
97 | XCASSET_FILES+=("$line")
98 | fi
99 | done <<<"$OTHER_XCASSETS"
100 |
101 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
102 | fi
103 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FTFoldingPaper_Tests/Pods-FTFoldingPaper_Tests-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
14 | FOUNDATION_EXPORT double Pods_FTFoldingPaper_TestsVersionNumber;
15 | FOUNDATION_EXPORT const unsigned char Pods_FTFoldingPaper_TestsVersionString[];
16 |
17 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FTFoldingPaper_Tests/Pods-FTFoldingPaper_Tests.debug.xcconfig:
--------------------------------------------------------------------------------
1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/FTFoldingPaper"
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/FTFoldingPaper/FTFoldingPaper.framework/Headers"
5 | PODS_BUILD_DIR = $BUILD_DIR
6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
7 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
8 | PODS_ROOT = ${SRCROOT}/Pods
9 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FTFoldingPaper_Tests/Pods-FTFoldingPaper_Tests.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods_FTFoldingPaper_Tests {
2 | umbrella header "Pods-FTFoldingPaper_Tests-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FTFoldingPaper_Tests/Pods-FTFoldingPaper_Tests.release.xcconfig:
--------------------------------------------------------------------------------
1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/FTFoldingPaper"
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/FTFoldingPaper/FTFoldingPaper.framework/Headers"
5 | PODS_BUILD_DIR = $BUILD_DIR
6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
7 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
8 | PODS_ROOT = ${SRCROOT}/Pods
9 |
--------------------------------------------------------------------------------
/Example/Tests/Tests-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundlePackageType
14 | BNDL
15 | CFBundleShortVersionString
16 | 1.0
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Example/Tests/Tests-Prefix.pch:
--------------------------------------------------------------------------------
1 | // The contents of this file are implicitly included at the beginning of every test case source file.
2 |
3 | #ifdef __OBJC__
4 |
5 |
6 |
7 | #endif
8 |
--------------------------------------------------------------------------------
/Example/Tests/Tests.m:
--------------------------------------------------------------------------------
1 | //
2 | // FTFoldingPaperTests.m
3 | // FTFoldingPaperTests
4 | //
5 | // Created by monofire on 05/27/2017.
6 | // Copyright (c) 2017 monofire. All rights reserved.
7 | //
8 |
9 | @import XCTest;
10 |
11 | @interface Tests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation Tests
16 |
17 | - (void)setUp
18 | {
19 | [super setUp];
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 | }
22 |
23 | - (void)tearDown
24 | {
25 | // Put teardown code here. This method is called after the invocation of each test method in the class.
26 | [super tearDown];
27 | }
28 |
29 | - (void)testExample
30 | {
31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
32 | }
33 |
34 | @end
35 |
36 |
--------------------------------------------------------------------------------
/Example/Tests/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/FTFoldingPaper.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # Be sure to run `pod lib lint FTFoldingPaper.podspec' to ensure this is a
3 | # valid spec before submitting.
4 | #
5 | # Any lines starting with a # are optional, but their use is encouraged
6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
7 | #
8 |
9 | Pod::Spec.new do |s|
10 | s.name = 'FTFoldingPaper'
11 | s.version = '0.1.0'
12 | s.summary = 'UI framework to emulate paper folding effects.'
13 |
14 | # This description is used to generate tags and improve search results.
15 | # * Think: What does it do? Why did you write it? What is the focus?
16 | # * Try to keep it short, snappy and to the point.
17 | # * Write the description between the DESC delimiters below.
18 | # * Finally, don't worry about the indent, CocoaPods strips it!
19 |
20 | s.description = <<-DESC
21 | FTFoldingPaper is a UI framework built on top of the Core Animation.
22 | It is designed to emulate paper folding effects and can be integrated with
23 | UITableView, used independently or paired with other UI components.
24 | DESC
25 |
26 | s.homepage = 'https://github.com/monofire/FTFoldingPaper'
27 | # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
28 | s.license = { :type => 'MIT', :file => 'LICENSE' }
29 | s.author = { 'monofire' => 'monofirehub@gmail.com' }
30 | s.source = { :git => 'https://github.com/monofire/FTFoldingPaper.git', :tag => s.version.to_s }
31 | # s.social_media_url = 'https://twitter.com/'
32 |
33 | s.ios.deployment_target = '8.3'
34 |
35 | s.source_files = 'FTFoldingPaper/**/*'
36 |
37 | # s.resource_bundles = {
38 | # 'FTFoldingPaper' => ['FTFoldingPaper/Assets/*.png']
39 | # }
40 |
41 | # s.public_header_files = 'Pod/Classes/**/*.h'
42 | # s.frameworks = 'UIKit', 'MapKit'
43 | # s.dependency 'AFNetworking', '~> 2.3'
44 | end
45 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/monofire/FTFoldingPaper/6f8bb78ea7635c8750b16342c23c246b20fcd907/FTFoldingPaper/Assets/.gitkeep
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/monofire/FTFoldingPaper/6f8bb78ea7635c8750b16342c23c246b20fcd907/FTFoldingPaper/Classes/.gitkeep
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/AnimationContextStructs.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #ifndef AnimationContextStructs_h
24 | #define AnimationContextStructs_h
25 |
26 |
27 |
28 | #pragma mark -
29 | #pragma mark - Gradient color animation
30 |
31 | struct FoldComponentGradientColorAnimationRange {
32 | CGColorRef topFoldStartColorFirstValue;
33 | CGColorRef topFoldStartColorLastValue;
34 | CGColorRef topFoldEndColorFirstValue;
35 | CGColorRef topFoldEndColorLastValue;
36 |
37 |
38 | CGColorRef bottomFoldStartColorFirstValue;
39 | CGColorRef bottomFoldStartColorLastValue;
40 | CGColorRef bottomFoldEndColorFirstValue;
41 | CGColorRef bottomFoldEndColorLastValue;
42 | };
43 |
44 |
45 | struct ColorComponents {
46 | CGFloat red;
47 | CGFloat green;
48 | CGFloat blue;
49 | CGFloat alpha;
50 | };
51 |
52 |
53 |
54 |
55 | #pragma mark -
56 | #pragma mark - Fold movement animation
57 | struct AnimationFrameParams {
58 | CGFloat topLayerRotation;
59 | CGFloat bottomLayerRotation;
60 | CGFloat foldHeight;
61 | CGFloat topLayerYTranslation;
62 | CGFloat bottomLayerYTranslation;
63 | };
64 |
65 |
66 | struct AnimationValueRange {
67 | CGFloat fromValue;
68 | CGFloat toValue;
69 | };
70 |
71 |
72 |
73 |
74 |
75 |
76 | #endif /* AnimationContextStructs_h */
77 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTAnimationContext+FoldComponentsAnimation.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import "FTAnimationContext.h"
24 |
25 | @interface FTAnimationContext (FoldComponentsAnimation)
26 |
27 |
28 | /* ::: Helper - cooks y-translation and rotation animations for fold components */
29 | -(NSArray *) foldAnimationsForFoldComponents: (NSArray *) foldComponents
30 | parentLayerAnimations: (FTParentLayerAnimations *) parentLayerAnimations;
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTAnimationContext+GradientColorAnimation.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import "FTAnimationContext.h"
24 |
25 |
26 | /* ::: Helper - cooks gradient animations for fold components */
27 | @interface FTAnimationContext (GradientColorAnimation)
28 |
29 | -(FTFoldComponentGradientAnimations*) foldComponentGradientAnimationsWithRange: (struct FoldComponentGradientColorAnimationRange)animationRange
30 | numberOfFrames:(NSInteger) numberOfFrames;
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTAnimationContext.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import
24 | #import
25 |
26 | #import "FTParentLayerAnimations.h"
27 | #import "FTFoldComponentAnimations.h"
28 | #import "FTFoldComponentGradientAnimations.h"
29 |
30 | #import "AnimationContextStructs.h"
31 |
32 |
33 | /* ::: FTAnimationContext is responsible for creating and proving
34 | animation objects based on the in-put config */
35 | @interface FTAnimationContext : NSObject
36 |
37 |
38 | -(instancetype) initWithCellFoldComponents: (NSArray*) cellFoldComponents;
39 |
40 |
41 |
42 | /* Depth of perspective effect. Default value -1.0f/500.0f */
43 | @property (nonatomic) CGFloat zPerspective;
44 |
45 |
46 | /* Duration of the cell expand aniamation, seconds */
47 | @property (nonatomic) CGFloat expandAnimationDuration;
48 |
49 | /* Duration of the cell collapse aniamation, seconds */
50 | @property (nonatomic) CGFloat collapseAnimationDuration;
51 |
52 | /* Destination angle between fold components at the end of expand animation
53 | 0.0f means fully opened fold. Default value -M_PI/6 */
54 | @property (nonatomic) CGFloat foldAngleFinalValue;
55 |
56 |
57 | /* Number of interpolation frames for all animations. More frames - more precise animation path. Default is 10 */
58 | @property (nonatomic) NSInteger numberOfAnimationInterpolationFrames;
59 |
60 | /*
61 | Animation flow effects
62 | https://developer.apple.com/reference/quartzcore/camediatimingfunction/predefined_timing_functions?language=objc */
63 | @property (nonatomic) CAMediaTimingFunction *animationMediaTimingFunction;
64 |
65 |
66 | /* calculate values for animation frames and create animation objects */
67 | -(void) calculate;
68 |
69 | /* provides precooked animations based on input configuration */
70 | @property (nonatomic, readonly) NSArray *foldComponentsAnimations;
71 |
72 |
73 | /* parent layer animation object */
74 | @property (nonatomic, readonly) FTParentLayerAnimations *parentLayerAnimations;
75 |
76 |
77 |
78 |
79 | /* Gradient animation params:
80 | Start color - start color of gradient fill itself
81 | End color - end color of gradient fill itself
82 | First value - color at the beginning of animation
83 | Last value - color at the end of aniamation
84 | */
85 | @property (nonatomic) struct FoldComponentGradientColorAnimationRange foldComponentGradientColorAnimationRange;
86 |
87 |
88 | /* fold gradient color animation object */
89 | @property (nonatomic, readonly) FTFoldComponentGradientAnimations *foldComponentGradientAnimations;
90 |
91 |
92 | @end
93 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTAnimationContext.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import "FTAnimationContext.h"
24 | #import "FTFoldComponent.h"
25 |
26 | #import "FTAnimationContext+GradientColorAnimation.h"
27 | #import "FTAnimationContext+FoldComponentsAnimation.h"
28 |
29 |
30 |
31 | @interface FTAnimationContext()
32 |
33 | @property (nonatomic, readwrite) NSArray *foldComponentsAnimations;
34 | @property (nonatomic, readwrite) FTParentLayerAnimations *parentLayerAnimations;
35 | @property (nonatomic, readwrite) FTFoldComponentGradientAnimations *foldComponentGradientAnimations;
36 |
37 | @end
38 |
39 | @implementation FTAnimationContext{
40 | NSArray *_foldComponents;
41 | }
42 |
43 |
44 | #pragma mark -
45 | #pragma mark - Init
46 |
47 | - (instancetype)init
48 | {
49 | NSLog(@"::: FTCellAnimationContext - initialisation ERROR ! Please use designated initialiser -(instancetype) initWithFoldLayerHeight: (CGFloat) foldLayerHeight");
50 | return nil;
51 | }
52 |
53 | -(instancetype) initWithCellFoldComponents: (NSArray*) cellFoldComponents{
54 |
55 | self = [super init];
56 | if (self) {
57 |
58 | _foldComponents = cellFoldComponents;
59 |
60 | /* set default values for input params */
61 | self.zPerspective = -1.0f/500.0f;
62 | self.expandAnimationDuration = 2.0f;
63 | self.collapseAnimationDuration = 2.0;
64 | self.foldAngleFinalValue = - M_PI/6;
65 | self.numberOfAnimationInterpolationFrames = 10;
66 | self.animationMediaTimingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
67 |
68 |
69 | _foldComponentGradientColorAnimationRange.topFoldStartColorFirstValue = [UIColor colorWithRed:0.5f green:0.5f blue:0.5f alpha:1.0f].CGColor; /* dark*/
70 | _foldComponentGradientColorAnimationRange.topFoldStartColorLastValue = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.2f].CGColor;
71 | _foldComponentGradientColorAnimationRange.topFoldEndColorFirstValue = [UIColor colorWithRed:0.5f green:0.5f blue:0.5f alpha:1.0f].CGColor; /* dark*/
72 | _foldComponentGradientColorAnimationRange.topFoldEndColorLastValue = [UIColor colorWithRed:0.5f green:0.5f blue:0.5f alpha:0.2f].CGColor;
73 |
74 | _foldComponentGradientColorAnimationRange.bottomFoldStartColorFirstValue = [UIColor colorWithRed:0.5f green:0.5f blue:0.5f alpha:1.0f].CGColor; /* dark*/
75 | _foldComponentGradientColorAnimationRange.bottomFoldStartColorLastValue = [UIColor colorWithRed:0.2f green:0.2f blue:0.2f alpha:0.2f].CGColor;
76 | _foldComponentGradientColorAnimationRange.bottomFoldEndColorFirstValue = [UIColor colorWithRed:0.5f green:0.5f blue:0.5f alpha:1.0f].CGColor; /* dark*/
77 | _foldComponentGradientColorAnimationRange.bottomFoldEndColorLastValue = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.05f].CGColor;
78 |
79 |
80 |
81 |
82 | }
83 |
84 |
85 | return self;
86 | }
87 |
88 |
89 |
90 | #pragma mark -
91 | #pragma mark - Animations creation
92 |
93 | -(void) calculate{
94 | [self createFoldComponentsAnimations];
95 | [self createGradientColorAnimations];
96 | }
97 |
98 |
99 | -(void) createFoldComponentsAnimations{
100 | self.parentLayerAnimations = [[FTParentLayerAnimations alloc]init];
101 | self.foldComponentsAnimations = [self foldAnimationsForFoldComponents:_foldComponents parentLayerAnimations:self.parentLayerAnimations];
102 | }
103 |
104 |
105 | -(void) createGradientColorAnimations{
106 | self.foldComponentGradientAnimations = [self foldComponentGradientAnimationsWithRange:self.foldComponentGradientColorAnimationRange
107 | numberOfFrames:self.numberOfAnimationInterpolationFrames];
108 | }
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 | @end
117 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTAnimationView+Tools.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import "FTAnimationView.h"
24 |
25 | /*::: helpers */
26 | @interface FTAnimationView (Tools)
27 |
28 | -(CGFloat) bottomFoldComponentYTranslation;
29 | -(void) removeAllAnimations;
30 | -(void) enableZPerspective;
31 | -(void) disableZPerspective;
32 | -(void) setSelfHeight: (CGFloat) height;
33 |
34 | @end
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTAnimationView+Tools.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import "FTAnimationView+Tools.h"
24 |
25 | @implementation FTAnimationView (Tools)
26 |
27 | -(CGFloat) bottomFoldComponentYTranslation{
28 |
29 | FTFoldComponentAnimations *foldComponentAnimations = [self.animationContext.foldComponentsAnimations lastObject];
30 | return [[foldComponentAnimations.bottomLayerYTranslationAnimation.values lastObject]floatValue];
31 | }
32 |
33 |
34 | -(void) removeAllAnimations{
35 |
36 | [self.layer removeAllAnimations];
37 |
38 | for (FTFoldComponent *foldComponent in self.foldComponents) {
39 | [foldComponent.topLayer removeAllAnimations];
40 | [foldComponent.bottomLayer removeAllAnimations];
41 | }
42 | }
43 |
44 | -(void) enableZPerspective{
45 | CATransform3D perspective = CATransform3DIdentity;
46 | perspective.m34 = self.animationContext.zPerspective;
47 | self.layer.sublayerTransform = perspective;
48 | }
49 |
50 | -(void) disableZPerspective{
51 | CATransform3D perspective = CATransform3DIdentity;
52 | perspective.m34 = 0.0f;
53 | self.layer.sublayerTransform = perspective;
54 | }
55 |
56 |
57 | -(void) setSelfHeight: (CGFloat) height{
58 |
59 | self.frame = CGRectMake(self.frame.origin.x,
60 | self.frame.origin.y,
61 | self.frame.size.width,
62 | height);
63 | }
64 |
65 |
66 |
67 | @end
68 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTAnimationView.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import
24 | #import
25 | #import "FTAnimationContext.h"
26 | #import "FTFoldComponent.h"
27 |
28 | /* ::: FTAnimationView hosts and manages fold FTFoldComponent objects */
29 |
30 |
31 | typedef enum{
32 | EXPAND_CELL_ANIMATION,
33 | COLLAPSE_CELL_ANIMATION,
34 | }AnimationType;
35 |
36 | typedef enum{
37 | ANIMATION_IDLE,
38 | EXPANDING_ANIMATION_IS_PERFORMING,
39 | COLLAPSING_ANIMATION_IS_PERFORMING,
40 | }AnimationState;
41 |
42 |
43 | typedef enum{
44 | ANIMATION_VIEW_IS_EXPANDED,
45 | ANIMATION_VIEW_IS_COLLAPSED
46 | }CurrentViewConfiguration;
47 |
48 |
49 | @class FTAnimationView;
50 |
51 |
52 | @protocol FTAnimationViewProtocol
53 |
54 | -(void) onAnimationViewHeightChanged: (CGFloat) heightChangePerFrame
55 | animationView: (FTAnimationView *) animationView;
56 |
57 |
58 | -(void) onAnimationViewAnimationFinishedWithLastFrameHeightChange: (CGFloat) lastFrameHeightChange
59 | animationType: (AnimationType) animationType
60 | animationView: (FTAnimationView *) animationView;
61 |
62 | @end
63 |
64 |
65 | @interface FTAnimationView : UIView
66 |
67 |
68 | @property (nonatomic, weak) id animationViewDelegate;
69 |
70 | /* change height with animation */
71 | -(void) animateWithType: (AnimationType) animationType;
72 |
73 | /* change height immediately */
74 | -(void) configureHeightImmediatelyWithType:(AnimationType) animationType;
75 |
76 | /* inspect state */
77 | @property (nonatomic) CGFloat destinationHeightAfterAnimation;
78 | @property (nonatomic,readonly) AnimationState animationState;
79 | @property (nonatomic,readonly) CurrentViewConfiguration currentViewConfiguration;
80 |
81 | /* animation components */
82 | /* can be changed after initalisation to alter content and animation behaviour */
83 | @property (nonatomic) NSArray *foldComponents;
84 | @property (nonatomic) FTAnimationContext *animationContext;
85 |
86 | /* while subclassing please override. Do not call directly */
87 | -(NSArray*) submitFoldComponents;
88 |
89 | /* might be overriden in subclasses to change default params of animation context */
90 | -(void) configureAnimationContext: (FTAnimationContext *) animationContext;
91 |
92 |
93 | @end
94 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTFoldComponent.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import
24 | #import
25 |
26 | @interface FTFoldComponent : NSObject
27 |
28 |
29 | /* ::: FTFoldComponent represents two folds coupled together */
30 |
31 | -(instancetype) initWithSuperView: (UIView *) superview
32 | topViewNibName: (NSString*) topViewNibName
33 | bottomViewNibName: (NSString*) bottomViewNibName;
34 |
35 |
36 | @property (nonatomic) UIView *topView;
37 | @property (nonatomic) UIView *bottomView;
38 |
39 | @property (nonatomic) CALayer *topLayer;
40 | @property (nonatomic) CALayer *bottomLayer;
41 |
42 | @property (nonatomic) CAGradientLayer *topGradientLayer;
43 | @property (nonatomic) CAGradientLayer *bottomGradientLayer;
44 |
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTFoldComponent.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import "FTFoldComponent.h"
24 |
25 |
26 | @implementation FTFoldComponent
27 |
28 |
29 | #pragma mark -
30 | #pragma mark - Init
31 | -(instancetype) initWithSuperView: (UIView *) superview
32 | topViewNibName: (NSString* )topViewNibName
33 | bottomViewNibName: (NSString* )bottomViewNibName{
34 |
35 | self = [super init];
36 | if (self) {
37 |
38 | [self initViewsWithTopViewNibName:topViewNibName
39 | bottomViewNibName:bottomViewNibName];
40 |
41 | [self setViewsWithFrame:superview.frame];
42 | [self setLayersWithSuperView:superview];
43 | }
44 | return self;
45 | }
46 |
47 |
48 |
49 | #pragma mark - Init Views
50 | -(void) initViewsWithTopViewNibName: (NSString* )topFragmentNibName
51 | bottomViewNibName: (NSString* )bottomViewNibName{
52 |
53 | self.topView = [[[NSBundle mainBundle] loadNibNamed:topFragmentNibName owner:nil options:nil]objectAtIndex:0];
54 | self.bottomView = [[[NSBundle mainBundle] loadNibNamed:bottomViewNibName owner:nil options:nil]objectAtIndex:0];
55 | }
56 |
57 | -(void) setViewsWithFrame: (CGRect) frame{
58 |
59 | self.topView.frame = CGRectMake(0.0f,
60 | 0.0f,
61 | frame.size.width,
62 | self.topView.bounds.size.height);
63 |
64 |
65 | self.bottomView.frame = CGRectMake(0.0f,
66 | 0.0f,
67 | frame.size.width,
68 | self.bottomView.bounds.size.height);
69 |
70 | }
71 |
72 | #pragma mark - Init Layers
73 | -(void) setLayersWithSuperView: (UIView*) superview{
74 |
75 | /* assign layers */
76 | self.topLayer = self.topView.layer;
77 | self.bottomLayer = self.bottomView.layer;
78 |
79 | /* set frames */
80 | self.topLayer.bounds = self.topView.bounds;
81 | self.bottomLayer.bounds = self.bottomView.bounds;
82 |
83 |
84 | /* set anchors */
85 | self.topLayer.anchorPoint = CGPointMake(0.0f, 0.0f);
86 | self.bottomLayer.anchorPoint = CGPointMake(0.0f, 1.0f);
87 |
88 | /* reset position */
89 | self.topLayer.position = CGPointZero;
90 | self.bottomLayer.position = CGPointZero;
91 |
92 |
93 | /* add gradient layers */
94 | [self setGradientLayersWithTopLayer:self.topLayer bottomLayer:self.bottomLayer];
95 |
96 | /* rotate layers to hide them from viewer */
97 | [self.topLayer setValue:[NSNumber numberWithFloat:-M_PI_2] forKeyPath:@"transform.rotation.x"];
98 | [self.bottomLayer setValue:[NSNumber numberWithFloat:M_PI_2] forKeyPath:@"transform.rotation.x"];
99 |
100 | /* enable antialiasing */
101 | self.topLayer.allowsEdgeAntialiasing = YES;
102 | self.bottomLayer.allowsEdgeAntialiasing = YES;
103 |
104 |
105 | /* add to superview */
106 | [superview addSubview:self.topView];
107 | [superview addSubview:self.bottomView];
108 |
109 | }
110 |
111 |
112 |
113 | /* init and set gradient layers */
114 | -(void) setGradientLayersWithTopLayer: (CALayer*) topLayer bottomLayer: (CALayer*) bottomLayer{
115 |
116 | self.topGradientLayer = [[CAGradientLayer alloc]init];
117 | self.topGradientLayer.frame = CGRectMake(0.0f, 0.0f, topLayer.bounds.size.width, topLayer.bounds.size.height);
118 |
119 | self.topGradientLayer.startPoint = CGPointMake(1.0f, 0.5f);
120 | self.topGradientLayer.endPoint = CGPointMake(0.0f, 0.5f);
121 |
122 |
123 | self.topGradientLayer.colors = @[(id)[UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.2f].CGColor,
124 | (id)[UIColor colorWithRed:0.5f green:0.5f blue:0.5f alpha:0.2f].CGColor];
125 |
126 | [topLayer addSublayer:self.topGradientLayer];
127 |
128 |
129 |
130 | self.bottomGradientLayer = [[CAGradientLayer alloc]init];
131 |
132 | self.bottomGradientLayer.frame = CGRectMake(0.0f, 0.0f, bottomLayer.bounds.size.width, bottomLayer.bounds.size.height);
133 |
134 | self.bottomGradientLayer.startPoint = CGPointMake(1.0f, 0.0f);
135 | self.bottomGradientLayer.endPoint = CGPointMake(0.0f, 1.0f);
136 |
137 |
138 | self.bottomGradientLayer.colors = @[(id)[UIColor colorWithRed:0.2f green:0.2f blue:0.2f alpha:0.2f].CGColor,
139 | (id)[UIColor colorWithRed:1 green:1 blue:1 alpha:0.05f].CGColor];
140 |
141 | [bottomLayer addSublayer:self.bottomGradientLayer];
142 | }
143 |
144 |
145 |
146 |
147 | @end
148 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTFoldComponentAnimations.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import
24 | #import
25 |
26 | /* ::: Value object */
27 |
28 | @interface FTFoldComponentAnimations : NSObject
29 |
30 | @property (nonatomic) CAKeyframeAnimation *topLayerRotationAnimation;
31 | @property (nonatomic) CAKeyframeAnimation *bottomLayerRotationAnimation;
32 | @property (nonatomic) CAKeyframeAnimation *topLayerYTranslationAnimation;
33 | @property (nonatomic) CAKeyframeAnimation *bottomLayerYTranslationAnimation;
34 |
35 |
36 | @property (nonatomic) CAKeyframeAnimation *topLayerRotationAnimationInverted;
37 | @property (nonatomic) CAKeyframeAnimation *bottomLayerRotationAnimationInverted;
38 | @property (nonatomic) CAKeyframeAnimation *topLayerYTranslationAnimationInverted;
39 | @property (nonatomic) CAKeyframeAnimation *bottomLayerYTranslationAnimationInverted;
40 |
41 |
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTFoldComponentAnimations.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import "FTFoldComponentAnimations.h"
24 |
25 | @implementation FTFoldComponentAnimations
26 | - (instancetype)init
27 | {
28 | self = [super init];
29 | if (self) {
30 |
31 | self.topLayerRotationAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.x"];
32 | self.bottomLayerRotationAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.x"];
33 | self.topLayerYTranslationAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.translation.y"];
34 | self.bottomLayerYTranslationAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.translation.y"];
35 |
36 |
37 | self.topLayerRotationAnimationInverted = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.x"];
38 | self.bottomLayerRotationAnimationInverted = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.x"];
39 | self.topLayerYTranslationAnimationInverted = [CAKeyframeAnimation animationWithKeyPath:@"transform.translation.y"];
40 | self.bottomLayerYTranslationAnimationInverted = [CAKeyframeAnimation animationWithKeyPath:@"transform.translation.y"];
41 |
42 | }
43 | return self;
44 | }
45 | @end
46 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTFoldComponentGradientAnimations.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import
24 | #import
25 |
26 | /* ::: Value object */
27 |
28 | @interface FTFoldComponentGradientAnimations : NSObject
29 |
30 | @property (nonatomic) CAKeyframeAnimation *topLayerGradientColorAnimation;
31 | @property (nonatomic) CAKeyframeAnimation *bottomLayerGradientColorAnimation;
32 |
33 | @property (nonatomic) CAKeyframeAnimation *topLayerGradientColorAnimationInverted;
34 | @property (nonatomic) CAKeyframeAnimation *bottomLayerGradientColorAnimationInverted;
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTFoldComponentGradientAnimations.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import "FTFoldComponentGradientAnimations.h"
24 |
25 | @implementation FTFoldComponentGradientAnimations
26 | - (instancetype)init
27 | {
28 | self = [super init];
29 | if (self) {
30 |
31 | self.topLayerGradientColorAnimation = [CAKeyframeAnimation animationWithKeyPath:@"colors"];
32 | self.bottomLayerGradientColorAnimation = [CAKeyframeAnimation animationWithKeyPath:@"colors"];
33 |
34 | self.topLayerGradientColorAnimationInverted = [CAKeyframeAnimation animationWithKeyPath:@"colors"];
35 | self.bottomLayerGradientColorAnimationInverted = [CAKeyframeAnimation animationWithKeyPath:@"colors"];
36 | }
37 | return self;
38 | }
39 | @end
40 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTFoldingPaper.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import
24 |
25 | #import
26 | #import
27 | #import
28 | #import
29 | #import
30 | #import
31 | #import
32 | #import
33 |
34 |
35 | #import
36 | #import
37 | #import
38 | #import
39 | #import
40 |
41 |
42 | //! Project version number for FTFoldingPaper.
43 | FOUNDATION_EXPORT double FTFoldingPaperVersionNumber;
44 |
45 | //! Project version string for FTFoldingPaper.
46 | FOUNDATION_EXPORT const unsigned char FTFoldingPaperVersionString[];
47 |
48 | // In this header, you should import all the public headers of your framework using statements like #import
49 |
50 |
51 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTParentLayerAnimations.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import
24 | #import
25 |
26 |
27 | /* ::: Value object to store animations of FTAnimationView's parent layer*/
28 |
29 | @interface FTParentLayerAnimations : NSObject
30 |
31 | @property (nonatomic) CAKeyframeAnimation *parentLayerHeightAnimation;
32 | @property (nonatomic) CAKeyframeAnimation *parentLayerHeightAnimationInverted;
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTParentLayerAnimations.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import "FTParentLayerAnimations.h"
24 |
25 | @implementation FTParentLayerAnimations
26 |
27 |
28 | - (instancetype)init
29 | {
30 | self = [super init];
31 | if (self) {
32 |
33 | self.parentLayerHeightAnimation = [CAKeyframeAnimation animationWithKeyPath:@"bounds.size.height"];
34 | self.parentLayerHeightAnimationInverted = [CAKeyframeAnimation animationWithKeyPath:@"bounds.size.height"];
35 |
36 | }
37 | return self;
38 | }
39 |
40 |
41 | @end
42 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTTableCell.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import
24 | #import "FTAnimationView.h"
25 | #import "FTTableCellSeparator.h"
26 |
27 |
28 | /*::: FTTableCell expands UITableViewCell functionality to host FTAnimationView and perform expand/collapse animations */
29 |
30 | @class FTTableCell;
31 |
32 | @protocol FTTableCellAnimationProtocol
33 |
34 | -(void) onCellHeightChanged: (CGFloat) cellHeightChangePerFrame
35 | currentHeight: (CGFloat) currentHeight
36 | cell: (FTTableCell *) cell;
37 |
38 | -(void) onCellHeightAnimationFinishedWithLastFrameHeightChange: (CGFloat) lastFrameHeightChange
39 | finalHeight: (CGFloat) finalHeight
40 | animationType: (AnimationType) animationType
41 | cell: (FTTableCell *) cell;
42 | @end
43 |
44 |
45 | @interface FTTableCell : UITableViewCell
46 |
47 | @property (nonatomic, weak) id cellDelegate;
48 |
49 |
50 |
51 |
52 | -(void) animateWithType: (AnimationType) animationType;
53 |
54 | @property (nonatomic) FTAnimationView *animationView;
55 | @property (nonatomic) FTTableCellSeparator *tableCellSeparator;
56 |
57 | /* while subclassing please override -(FTAnimationView*) submitAnimationView; */
58 | /* do not call directly */
59 | -(FTAnimationView*) submitAnimationView;
60 |
61 | /* Submit gradient layer to be applied on the cell. No frame is required. Default value is nil */
62 | -(CAGradientLayer* ) submitGradientLayer;
63 |
64 | /* Submit cell separator. Do not override if you need cell without separator */
65 | -(FTTableCellSeparator* ) submitCellSeparator;
66 |
67 |
68 | @end
69 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTTableCell.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import "FTTableCell.h"
24 |
25 | @interface FTTableCell()
26 |
27 | @end
28 |
29 | @implementation FTTableCell{
30 | CGFloat _initialCellHeight;
31 |
32 | BOOL _gradientLayerLayoutIsNeeded;
33 | BOOL _separatorViewLayoutIsNeeded;
34 |
35 | CAGradientLayer *_gradientLayer;
36 | }
37 |
38 |
39 | #pragma mark -
40 | #pragma mark - Lifecycle
41 |
42 | /* called by table model while registering this cell for table view */
43 | - (void)awakeFromNib {
44 | [super awakeFromNib];
45 | [self onAwakeFromNib];
46 | }
47 |
48 |
49 | -(void)layoutSubviews{
50 | [super layoutSubviews];
51 |
52 | if (_separatorViewLayoutIsNeeded){
53 | _separatorViewLayoutIsNeeded = NO;
54 | CGFloat separatorWidth = self.bounds.size.width - (self.tableCellSeparator.offsetFromCellLeftEdge + self.tableCellSeparator.offsetFromCellRightEdge);
55 | self.tableCellSeparator.frame = CGRectMake(self.tableCellSeparator.offsetFromCellLeftEdge,
56 | self.bounds.size.height - self.tableCellSeparator.height,
57 | separatorWidth,
58 | self.tableCellSeparator.height);
59 | };
60 |
61 |
62 | if (_gradientLayerLayoutIsNeeded){
63 | _gradientLayerLayoutIsNeeded = NO;
64 | _gradientLayer.frame = self.contentView.frame;
65 | }
66 | }
67 |
68 | #pragma mark -
69 | #pragma mark - Animation view setup
70 | /* while subclassing please override -(FTAnimationView*) submitAnimationView; */
71 | /* do not call directly */
72 | -(FTAnimationView*) submitAnimationView{
73 |
74 | /* Example:
75 |
76 | FTAnimationView *animationView = [[FTAnimationView alloc]init];
77 | return animationView;
78 |
79 | */
80 |
81 | NSLog(@"::: FTTableCell initialisation ERROR! You must override -(FTAnimationView*) setupAnimationView; in subclasses of FTTableCell %p", self);
82 | return nil;
83 | }
84 |
85 |
86 |
87 | #pragma mark -
88 | #pragma mark - Gradient layer setup
89 | -(CAGradientLayer*) submitGradientLayer{
90 |
91 | /* use only on devices with high performance
92 | default is nil*/
93 |
94 | /* example
95 | CAGradientLayer *gradientLayer = [[CAGradientLayer alloc]init];
96 |
97 | gradientLayer.startPoint = CGPointMake(1.0f, 0.5f);
98 | gradientLayer.endPoint = CGPointMake(0.0f, 0.5f);
99 |
100 | gradientLayer.colors = @[(id)[UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.2f].CGColor,
101 | (id)[UIColor colorWithRed:0.5f green:0.5f blue:0.5f alpha:0.2f].CGColor];
102 | */
103 |
104 | return nil;
105 | }
106 |
107 |
108 |
109 | #pragma mark -
110 | #pragma mark - Initial setup
111 |
112 | -(void) onAwakeFromNib{
113 |
114 | self.selectedBackgroundView = nil;
115 |
116 | /* save initial cell height */
117 | _initialCellHeight = self.bounds.size.height;
118 |
119 | /* disable selection */
120 | self.selectionStyle = UITableViewCellSelectionStyleNone;
121 |
122 | [self requestAnimationView];
123 |
124 | [self requestCellSeparator];
125 |
126 | [self requestGradientLayer];
127 | }
128 |
129 |
130 | -(void)requestGradientLayer{
131 |
132 | _gradientLayer = [self submitGradientLayer];
133 | if (_gradientLayer){
134 | _gradientLayerLayoutIsNeeded = YES;
135 | [self.layer addSublayer:_gradientLayer];
136 | }
137 | }
138 |
139 |
140 |
141 | -(void)requestAnimationView{
142 |
143 | self.animationView = [self submitAnimationView];
144 |
145 | self.animationView.animationViewDelegate = self;
146 |
147 | /* set animation view to initial position - at the bottom of the cell, horisontally sized to the screen size and invisible with height 0 */
148 | self.animationView.frame = CGRectMake(0.0f, self.bounds.size.height, [[UIScreen mainScreen]bounds].size.width, 0.0f);
149 |
150 | /* add animation view to the cell hierarchy */
151 | [self.contentView addSubview:self.animationView];
152 |
153 | }
154 |
155 |
156 | -(void) requestCellSeparator{
157 |
158 | self.tableCellSeparator = [self submitCellSeparator];
159 | if (self.tableCellSeparator){
160 | _separatorViewLayoutIsNeeded = YES;
161 | [self.contentView addSubview:self.tableCellSeparator];
162 | }
163 | }
164 |
165 | -(FTTableCellSeparator *) submitCellSeparator{
166 |
167 | /* default is nil */
168 | return nil;
169 | }
170 |
171 | #pragma mark - Animation operations
172 | -(void) animateWithType: (AnimationType) animationType{
173 |
174 | if(animationType == EXPAND_CELL_ANIMATION)
175 | /* disable subviews clipping to ensure that fold component's subviews are visible */
176 | self.contentView.clipsToBounds = NO;
177 | else
178 | self.contentView.clipsToBounds = YES;
179 |
180 | /* hide separator if any for better visual perception during animation */
181 | if (self.tableCellSeparator)
182 | [self.tableCellSeparator hide];
183 |
184 | [self.animationView animateWithType:animationType];
185 | }
186 |
187 |
188 |
189 | #pragma mark - Animation tools
190 | -(void) updateSelfHeightWithChange: (CGFloat) heightChange{
191 |
192 | self.frame = CGRectMake(self.frame.origin.x,
193 | self.frame.origin.y,
194 | self.frame.size.width,
195 | self.frame.size.height + heightChange);
196 |
197 | }
198 |
199 |
200 | #pragma mark - Animation view calls
201 | -(void) onAnimationViewHeightChanged: (CGFloat) heightChangePerFrame
202 | animationView: (FTAnimationView *) animationView{
203 |
204 | [self updateSelfHeightWithChange:heightChangePerFrame];
205 |
206 | /* pass event to the next delegate */
207 | if (self.cellDelegate)
208 | [self.cellDelegate onCellHeightChanged:heightChangePerFrame currentHeight:self.bounds.size.height cell:self];
209 |
210 |
211 | }
212 |
213 |
214 | -(void) onAnimationViewAnimationFinishedWithLastFrameHeightChange: (CGFloat) lastFrameHeightChange
215 | animationType: (AnimationType) animationType
216 | animationView: (FTAnimationView *) animationView{
217 |
218 | /* set final height */
219 | [self updateSelfHeightWithChange:lastFrameHeightChange];
220 |
221 | /* show separator if any after animation */
222 | if (self.tableCellSeparator && animationType == COLLAPSE_CELL_ANIMATION)
223 | [self.tableCellSeparator show];
224 |
225 |
226 | /* pass event to the next delegate */
227 | if (self.cellDelegate)
228 | [self.cellDelegate onCellHeightAnimationFinishedWithLastFrameHeightChange:lastFrameHeightChange
229 | finalHeight: self.animationView.destinationHeightAfterAnimation + _initialCellHeight animationType:animationType
230 | cell:self];
231 | }
232 |
233 |
234 |
235 | @end
236 |
237 |
238 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTTableCellMetadata.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import
24 | #import
25 |
26 | @interface FTTableCellMetadata : NSObject
27 |
28 |
29 | -(instancetype) initWithReuseID: (NSString *) reuseID
30 | isExpandable: (BOOL) isExpandable
31 | isExpanded: (BOOL) isExpanded;
32 |
33 | @property (nonatomic) NSString *cellReuseID;
34 | @property (nonatomic) CGFloat cellCollapsedHeight;
35 | @property (nonatomic) CGFloat cellCurrentHeight;
36 | @property (nonatomic) BOOL isExpanded;
37 | @property (nonatomic) BOOL isExpandable;
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTTableCellMetadata.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import "FTTableCellMetadata.h"
24 |
25 | @implementation FTTableCellMetadata
26 |
27 |
28 |
29 | -(instancetype) initWithReuseID: (NSString *) reuseID
30 | isExpandable: (BOOL) isExpandable
31 | isExpanded: (BOOL) isExpanded{
32 |
33 | self = [super init];
34 | if (self) {
35 | self.cellReuseID = reuseID;
36 | self.cellCollapsedHeight = -1;
37 | self.cellCurrentHeight = -1;
38 | self.isExpandable = isExpandable;
39 | self.isExpanded = isExpanded;
40 |
41 | }
42 | return self;
43 | }
44 |
45 |
46 | - (instancetype)init
47 | {
48 | self = [super init];
49 | if (self) {
50 | self.cellReuseID = @"";
51 | self.cellCollapsedHeight = -1;
52 | self.cellCurrentHeight = -1;
53 | self.isExpandable = NO;
54 | self.isExpanded = NO;
55 | }
56 | return self;
57 | }
58 |
59 | @end
60 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTTableCellSeparator.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import
24 |
25 |
26 | /*::: FTTableCellSeparator replaces standard separator entity for FTTableCell */
27 |
28 |
29 | @interface FTTableCellSeparator : UIView
30 |
31 | -(instancetype)initWithHeight:(CGFloat)height
32 | offsetFromCellLeftEdge:(CGFloat) offsetFromCellLeftEdge
33 | offsetFromCellRightEdge:(CGFloat) offsetFromCellRightEdge
34 | color:(UIColor*) color;
35 |
36 | @property (nonatomic,readonly) CGFloat height;
37 | @property (nonatomic,readonly) CGFloat offsetFromCellLeftEdge;
38 | @property (nonatomic,readonly) CGFloat offsetFromCellRightEdge;
39 |
40 | -(void) hide;
41 | -(void) show;
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTTableCellSeparator.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import "FTTableCellSeparator.h"
24 |
25 |
26 |
27 |
28 | @interface FTTableCellSeparator()
29 |
30 | @property (nonatomic,readwrite) CGFloat height;
31 | @property (nonatomic,readwrite) CGFloat offsetFromCellLeftEdge;
32 | @property (nonatomic,readwrite) CGFloat offsetFromCellRightEdge;
33 |
34 |
35 | @end
36 |
37 | @implementation FTTableCellSeparator
38 |
39 |
40 |
41 | -(instancetype)initWithFrame:(CGRect)frame{
42 | NSLog(@"::: FTTableCellSeparator initialisation ERROR! Please use designated initWithHeight: offsetFromCellLeftEdge: offsetFromCellRightEdge: color: instead");
43 | return nil;
44 | }
45 |
46 | -(instancetype)initWithHeight:(CGFloat)height
47 | offsetFromCellLeftEdge:(CGFloat)offsetFromCellLeftEdge
48 | offsetFromCellRightEdge:(CGFloat)offsetFromCellRightEdge
49 | color:(UIColor*) color{
50 |
51 | self = [super initWithFrame:CGRectZero];
52 | if (self) {
53 | self.height = height;
54 | self.offsetFromCellLeftEdge = offsetFromCellLeftEdge;
55 | self.offsetFromCellRightEdge = offsetFromCellRightEdge;
56 | self.backgroundColor = color;
57 | }
58 | return self;
59 | }
60 |
61 |
62 | -(void) hide{
63 | self.alpha = 0;
64 | }
65 |
66 |
67 | -(void) show{
68 | self.alpha = 1;
69 | }
70 |
71 |
72 | @end
73 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTTableModel.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import
24 | #import
25 | #import "FTTableCellMetadata.h"
26 | #import "FTTableCell.h"
27 |
28 |
29 | @interface FTTableModel : NSObject
30 |
31 | @property (nonatomic) NSMutableArray *tableCellsMetadata;
32 |
33 | /* to be overrriden in subclass. Do not call */
34 | -(NSDictionary*) submitCellsIDs;
35 | -(NSMutableArray *) submitTableCellsMetadata;
36 |
37 |
38 | /* Table View Contoller interface */
39 | -(void) registerCellsForTable: (UITableView *) table;
40 |
41 | -(CGFloat) collapsedHeightForExpandedCellIfAny: (FTTableCell *) cell;
42 | -(void) addCellToExpandedCellsPool: (FTTableCell *) cell withCollapsedHeight: (CGFloat) collapsedHeight;
43 | -(void) removeCellToExpandedCellsPool: (FTTableCell *) cell;
44 |
45 |
46 |
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTTableModel.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 |
24 |
25 | #import "FTTableModel.h"
26 |
27 | @implementation FTTableModel{
28 |
29 | NSDictionary *_cellReuseAndXibIDs;
30 | NSMutableDictionary *_expandedCells;
31 | }
32 |
33 |
34 |
35 | #pragma mark -
36 | #pragma mark - Init
37 | - (instancetype)init
38 | {
39 | self = [super init];
40 | if (self) {
41 | _expandedCells = [[NSMutableDictionary alloc]init];
42 | _cellReuseAndXibIDs = [self submitCellsIDs];
43 | self.tableCellsMetadata = [self submitTableCellsMetadata];
44 | }
45 | return self;
46 | }
47 |
48 |
49 |
50 |
51 | -(NSDictionary*) submitCellsIDs{
52 |
53 | NSLog(@"FTTableModel initalisation ERROR! You have to override -(NSDictionary*) submitCellsIDs");
54 |
55 | /* set here cells that will be used in table... */
56 | /* usign dictionary format - cell reuse ID : cell xib name */
57 |
58 | /* example
59 | return @{@"StandardTableViewCellID":@"StandardTableViewCell",
60 | @"ExpandingTableViewCellID":@"ExpandingTableViewCell"};
61 | */
62 |
63 | return nil;
64 | }
65 |
66 |
67 | /* design structure of your table view content here... */
68 | -(NSMutableArray *) submitTableCellsMetadata{
69 |
70 | NSLog(@"FTTableModel initalisation ERROR! You have to override -(NSMutableArray *) submitTableCellsMetadata");
71 |
72 | /* example
73 | for (NSInteger i = 0; i < 15; i++) {
74 |
75 | FTTableCellMetadata *tableCellMetadata = nil;
76 |
77 |
78 | if (i==0 || i==2 || i==5 || i==7 || i==12){
79 | tableCellMetadata = [[FTTableCellMetadata alloc]initWithReuseID:@"StandardTableViewCellID" isExpandable:NO isExpanded:NO];
80 |
81 | [self.tableCellsMetadata addObject:tableCellMetadata];
82 | continue;
83 | }
84 |
85 | tableCellMetadata = [[FTTableCellMetadata alloc]initWithReuseID:@"ExpandingTableViewCellID" isExpandable:YES isExpanded:NO];
86 | [self.tableCellsMetadata addObject:tableCellMetadata];
87 | }
88 | */
89 |
90 | return nil;
91 | }
92 |
93 |
94 |
95 | #pragma mark -
96 | #pragma mark - Table View Controller Interface
97 | -(void) registerCellsForTable: (UITableView *) table {
98 |
99 | NSArray *cellReuseIDs = [_cellReuseAndXibIDs allKeys];
100 |
101 | for (NSString *cellReuseID in cellReuseIDs){
102 | NSString *cellXibName = [_cellReuseAndXibIDs objectForKey:cellReuseID];
103 | UINib *cellNib = [UINib nibWithNibName:cellXibName bundle:nil];
104 | [table registerNib:cellNib forCellReuseIdentifier:cellReuseID];
105 | }
106 | }
107 |
108 |
109 |
110 | #pragma mark - Expanded cells pool operations
111 | - (CGFloat) collapsedHeightForExpandedCellIfAny: (FTTableCell *) cell{
112 |
113 | NSNumber *collapsedHeight = [_expandedCells objectForKey:[NSValue valueWithPointer:(__bridge const void * _Nullable)(cell)]];
114 | if (collapsedHeight)
115 | return [collapsedHeight floatValue];
116 |
117 | return -1; /* if no object found = no expanded cells with that address */
118 | }
119 |
120 | -(void) addCellToExpandedCellsPool: (FTTableCell *) cell withCollapsedHeight: (CGFloat) collapsedHeight{
121 | [_expandedCells setObject:[NSNumber numberWithFloat:collapsedHeight] forKey:[NSValue valueWithPointer:(__bridge const void * _Nullable)(cell)]];
122 | }
123 |
124 | -(void) removeCellToExpandedCellsPool: (FTTableCell *) cell{
125 | [_expandedCells removeObjectForKey:[NSValue valueWithPointer:(__bridge const void * _Nullable)(cell)]];
126 | }
127 |
128 |
129 |
130 | @end
131 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTTableView.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import
24 | #import "FTTableCell.h"
25 |
26 | /*::: FTTableView expands UITableView to operate with FTTableCell and animations */
27 |
28 | @protocol FTTableViewAnimationProtocol
29 |
30 | -(void) onSelectedCellExpanded: (FTTableCell *) selectedCell atIndexPath:(NSIndexPath*) indexPath;
31 | -(void) onSelectedCellCollapsed: (FTTableCell *) selectedCell atIndexPath:(NSIndexPath*) indexPath;
32 | -(void) onSelectedCell: (FTTableCell*) selectedCell heightUpdate: (CGFloat) newCellHeight atIndexPath:(NSIndexPath*) indexPath;
33 |
34 | @end
35 |
36 |
37 | @interface FTTableView : UITableView
38 |
39 |
40 | -(void) animateCell: (FTTableCell *) cell withAnimationType: (AnimationType) animationType;
41 |
42 |
43 | @property (nonatomic, weak) id tableAnimationDelegate;
44 |
45 |
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTViewController+CellsConfiguration.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import "FTViewController.h"
24 |
25 | @interface FTViewController (CellsConfiguration)
26 |
27 | -(void) setCellHeightMetadata: (FTTableCellMetadata*) cellMetadata withCell: (UITableViewCell*) cell tableModel: (FTTableModel*) tableModel;
28 | -(void) setAnimationViewConfigurationIfNeededWithCellMetadata: (FTTableCellMetadata*) cellMetadata withCell: (FTTableCell*) expandableCell;
29 |
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTViewController+CellsConfiguration.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import "FTViewController+CellsConfiguration.h"
24 |
25 | @implementation FTViewController (CellsConfiguration)
26 |
27 | -(void) setCellHeightMetadata: (FTTableCellMetadata*) cellMetadata withCell: (UITableViewCell*) cell tableModel: (FTTableModel*) tableModel{
28 |
29 |
30 | /* default value for tableCellMetadata.cellCollapsedHeight is -1. < 0 means height is not set */
31 | BOOL cellHasHeightMetadata = cellMetadata.cellCollapsedHeight > 0;
32 |
33 |
34 | /* A: if cell height data is available for this row */
35 | if (cellHasHeightMetadata){
36 |
37 | /*A1: if cell should be collapased */
38 | if (!cellMetadata.isExpanded)
39 | cellMetadata.cellCurrentHeight = cellMetadata.cellCollapsedHeight;
40 | /*A2: cellMetadata.isExpanded scenario will be execuded by default */
41 | }
42 |
43 |
44 | /* B: if cell height data is NOT available for this row */
45 | else{
46 |
47 | CGFloat collapsedHeightForExpandedCell = 0;
48 |
49 | /* lookup in already expanded cells pool */
50 | if (cellMetadata.isExpandable)
51 | collapsedHeightForExpandedCell = [tableModel collapsedHeightForExpandedCellIfAny:(FTTableCell*)cell];
52 |
53 |
54 | /* if UITableView is trying to reuse already expanded cell for row which should be collapsed */
55 | /* read and set collapsed height of this cell */
56 | BOOL collapsedHeightForExpandedCellIsFound = collapsedHeightForExpandedCell > 0; /* -1 means no expanded cell is found */
57 |
58 | if (collapsedHeightForExpandedCellIsFound)
59 | cellMetadata.cellCollapsedHeight = collapsedHeightForExpandedCell;
60 |
61 |
62 | else
63 | /* no expanded cell is found */
64 | /* means dequeued cell is not expanded and current height is collapsed height */
65 | cellMetadata.cellCollapsedHeight = cell.bounds.size.height;
66 |
67 | /* setup current height if needed */
68 | BOOL cellCurrentHeightIsNotDefined = cellMetadata.cellCurrentHeight < 0; /* -1 means cellCurrentHeight is not set */
69 | if (cellCurrentHeightIsNotDefined)
70 | cellMetadata.cellCurrentHeight = cellMetadata.cellCollapsedHeight;
71 | }
72 |
73 |
74 | }
75 |
76 | -(void) setAnimationViewConfigurationIfNeededWithCellMetadata: (FTTableCellMetadata*) cellMetadata withCell: (FTTableCell*) expandableCell{
77 |
78 | BOOL animationViewNeedsToBeExpanded = cellMetadata.isExpanded &&
79 | expandableCell.animationView.currentViewConfiguration == ANIMATION_VIEW_IS_COLLAPSED &&
80 | expandableCell.animationView.animationState == ANIMATION_IDLE;
81 |
82 |
83 | BOOL animationViewNeedsToBeCollapsed = !cellMetadata.isExpanded &&
84 | expandableCell.animationView.currentViewConfiguration == ANIMATION_VIEW_IS_EXPANDED &&
85 | expandableCell.animationView.animationState == ANIMATION_IDLE;;
86 |
87 |
88 | if (animationViewNeedsToBeExpanded){
89 | if (expandableCell.tableCellSeparator)
90 | [expandableCell.tableCellSeparator hide];
91 | [expandableCell.animationView configureHeightImmediatelyWithType:EXPAND_CELL_ANIMATION];
92 | }
93 |
94 | if (animationViewNeedsToBeCollapsed){
95 | if (expandableCell.tableCellSeparator)
96 | [expandableCell.tableCellSeparator show];
97 | [expandableCell.animationView configureHeightImmediatelyWithType:COLLAPSE_CELL_ANIMATION];
98 | }
99 | }
100 |
101 | @end
102 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTViewController.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import "FTTableModel.h"
24 | #import "FTTableView.h"
25 |
26 |
27 | /* ::: FTViewController bridges FTTableView with FTTableModel and extends UITableViewDelegate,
28 | UITableViewDataSource functionality in order to support expand/collapse animations of FTTableCell */
29 |
30 |
31 | @interface FTViewController : UIViewController
32 |
33 | /* to be overrriden in subclass. Do not call directly */
34 | -(FTTableModel*) submitTableModel;
35 | -(FTTableView*) submitTableView;
36 |
37 |
38 | /* to called in subclass. Do not override */
39 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
40 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
41 | -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
42 | -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
43 |
44 |
45 | -(FTTableCellMetadata *) tableCellMetadataForRowAtIndex:(NSIndexPath*) indexPath;
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/FTFoldingPaper/Classes/FTViewController.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2017 monofire
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #import "FTViewController.h"
24 | #import "FTViewController+CellsConfiguration.h"
25 |
26 | @interface FTViewController ()
27 |
28 | @end
29 |
30 |
31 | #pragma mark -
32 | #pragma mark - Init
33 |
34 | @implementation FTViewController{
35 | FTTableView *_tableView;
36 | FTTableModel *_tableModel;
37 | }
38 |
39 | -(FTTableModel*) submitTableModel{
40 |
41 | NSLog(@"FTViewController initalisation ERROR! You have to override -(FTTableModel*) submitTableModel");
42 | return nil;
43 | }
44 |
45 | -(FTTableView*) submitTableView{
46 |
47 | NSLog(@"FTViewController initalisation ERROR! You have to override -(FTTableView*) submitTableView");
48 | return nil;
49 | }
50 |
51 |
52 |
53 | #pragma mark -
54 | #pragma mark - Lifecycle
55 |
56 | -(void)awakeFromNib{
57 | [super awakeFromNib];
58 | _tableModel = [self submitTableModel];
59 |
60 | }
61 |
62 | -(void)viewDidLoad{
63 | [super viewDidLoad];
64 |
65 | /* to be called once, after tableView is loaded */
66 | /* NOTE: in your project you must ensure that -onTableViewIsLoaded is called once per this view controller lifecycle
67 | and if needed delegete -onTableViewIsLoaded call to the object which controlls this controller life cycle e.g parent view controller, etc */
68 | [self onTableViewIsLoaded];
69 | }
70 |
71 | -(void)onTableViewIsLoaded{
72 |
73 | _tableView = [self submitTableView];
74 | [self setupTableModel];
75 | [self setupTable];
76 | }
77 |
78 |
79 | #pragma mark -
80 | #pragma mark - Table Model
81 | -(void) setupTableModel{
82 | [_tableModel registerCellsForTable:_tableView];
83 | }
84 |
85 |
86 | -(FTTableCellMetadata *) tableCellMetadataForRowAtIndex:(NSIndexPath*) indexPath{
87 | return [_tableModel.tableCellsMetadata objectAtIndex:indexPath.row];
88 | }
89 |
90 | #pragma mark -
91 | #pragma mark - Table View
92 | -(void) setupTable{
93 | _tableView.tableAnimationDelegate = self;
94 | }
95 |
96 |
97 |
98 | #pragma mark -
99 | #pragma mark - Calls from UITableView
100 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
101 | return _tableModel.tableCellsMetadata.count;
102 | }
103 |
104 |
105 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
106 |
107 | FTTableCellMetadata *tableCellMetadata = [_tableModel.tableCellsMetadata objectAtIndex:indexPath.row];
108 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:tableCellMetadata.cellReuseID];
109 |
110 | [self setCellHeightMetadata:tableCellMetadata withCell:cell tableModel:_tableModel];
111 | if (tableCellMetadata.isExpandable)
112 | [self setAnimationViewConfigurationIfNeededWithCellMetadata:tableCellMetadata withCell:(FTTableCell*)cell];
113 |
114 | return cell;
115 | }
116 |
117 |
118 | -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
119 |
120 | FTTableCellMetadata *tableCellMetadata = [_tableModel.tableCellsMetadata objectAtIndex:indexPath.row];
121 | return tableCellMetadata.cellCurrentHeight;
122 | }
123 |
124 |
125 |
126 | #pragma mark - Cell Selection
127 | -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
128 |
129 | FTTableCellMetadata *tableCellMetadata = [_tableModel.tableCellsMetadata objectAtIndex:indexPath.row];
130 |
131 | /* process cell selection */
132 | if (tableCellMetadata.isExpandable){
133 |
134 | FTTableCell *cell = [tableView cellForRowAtIndexPath:indexPath];
135 |
136 | if (tableCellMetadata.isExpanded){
137 | [_tableView animateCell:cell withAnimationType:COLLAPSE_CELL_ANIMATION];
138 | }
139 | else{
140 | [_tableView animateCell:cell withAnimationType:EXPAND_CELL_ANIMATION];
141 | }
142 | }
143 | }
144 |
145 |
146 |
147 |
148 | #pragma mark -
149 | #pragma mark - Calls from FTTableView
150 | -(void) onSelectedCell: (FTTableCell*) selectedCell heightUpdate: (CGFloat) newCellHeight atIndexPath:(NSIndexPath*) indexPath{
151 |
152 | /* update cell metadata */
153 | FTTableCellMetadata *tableCellMetadata = [_tableModel.tableCellsMetadata objectAtIndex:indexPath.row];
154 | tableCellMetadata.cellCurrentHeight = newCellHeight;
155 | }
156 |
157 |
158 | -(void)onSelectedCellCollapsed:(FTTableCell *)cell atIndexPath:(NSIndexPath*) indexPath{
159 |
160 | /* update cell metadata */
161 | FTTableCellMetadata *tableCellMetadata = [_tableModel.tableCellsMetadata objectAtIndex:indexPath.row];
162 | tableCellMetadata.isExpanded = NO;
163 |
164 | [_tableModel removeCellToExpandedCellsPool:cell];
165 | }
166 |
167 |
168 | -(void)onSelectedCellExpanded:(FTTableCell *)cell atIndexPath:(NSIndexPath*) indexPath{
169 |
170 | /* update cell metadata */
171 | FTTableCellMetadata *tableCellMetadata = [_tableModel.tableCellsMetadata objectAtIndex:indexPath.row];
172 | tableCellMetadata.isExpanded = YES;
173 |
174 | [_tableModel addCellToExpandedCellsPool:cell withCollapsedHeight:tableCellMetadata.cellCollapsedHeight];
175 | }
176 |
177 |
178 |
179 | @end
180 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2017 monofire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # FTFoldingPaper
2 |
3 | [](https://travis-ci.org/monofire/FTFoldingPaper)
4 | [](http://cocoapods.org/pods/FTFoldingPaper)
5 | [](http://cocoapods.org/pods/FTFoldingPaper)
6 | [](http://cocoapods.org/pods/FTFoldingPaper)
7 |
8 |
9 | FTFoldingPaper is a UI framework built on top of the [Core Animation](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004514). It is designed to emulate paper folding effects and can be integrated with [UITableView](https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/TableView_iPhone/AboutTableViewsiPhone/AboutTableViewsiPhone.html), used independently or paired with other UI components.
10 |
11 | 
12 |
13 | ## How To Get Started
14 | - [Download FTFoldingPaper](https://github.com/monofire/FTFoldingPaper/archive/master.zip) and try it out.
15 | - Install FTFoldingPaper to your project using CocoaPods.
16 | - Follow instructions below.
17 |
18 | ## Installation with CocoaPods
19 | [CocoaPods](https://cocoapods.org) is a dependency manager, which automates and simplifies the process of using 3rd-party libraries like FTFoldingPaper in your projects.
20 |
21 |
22 | You can install CocoaPods with the following command:
23 | ```bash
24 | $ sudo gem install cocoapods
25 | ```
26 |
27 | Then execute:
28 | ```bash
29 | $ cd
30 | $ pod init
31 | ```
32 |
33 | Open pod file for edit with Xcode or another editor:
34 | ```
35 | $ open -a Xcode podfile
36 | ```
37 |
38 | Add the following text under "target 'your project name' do" line:
39 | ```ruby
40 | pod 'FTFoldingPaper'
41 | ```
42 |
43 | Finally, execute:
44 | ```bash
45 | $ pod install
46 | ```
47 |
48 | You're done! Now open your project by clicking on the newly created xcworkspace file.
49 |
50 |
51 |
52 |
53 | ## Architecture:
54 | 
55 |
56 | **Paper folding animation:**
57 | FTFoldComponent
58 | FTAnimationView
59 | FTAnimationContext
60 | FTParentLayerAnimations
61 | FTFoldComponentAnimations
62 | FTFoldComponentGradientAnimations
63 |
64 | **Integration with UITableView:**
65 | FTViewController
66 | FTTableModel
67 | FTTableCellMetadata
68 | FTTableView
69 | FTTableCell
70 | FTTableCellSeparator
71 |
72 |
73 | ## Usage:
74 |
75 | 1. Create xibs of the top and bottom layers for all your fold components.
76 | Note that each fold component requires top and bottom layers.
77 |
78 | 1.1 Press '⌘ + N'. Select "User Interface" -> "View"
79 | 1.2 Open and edit each xib according to your needs: (add UI components, setup Autolayout).
80 | 1.3 Create data model object to manage UI components of your layer, if any required.
81 |
82 | 2. Subclass and configure `FTAnimationView` with `FTFoldComponents` and `FTAnimationContext`.
83 |
84 | `FTAnimationView` hosts fold components and manages animation. Animation process is configured with `FTAnimationContext`
85 |
86 | Override the next two methods in `FTAnimationView`:
87 | ```objective-c
88 | /* example of animation view with 2 fold components*/
89 | -(NSArray *)submitFoldComponents{
90 |
91 | FTFoldComponent *foldComponentA = [[FTFoldComponent alloc]initWithSuperView:self
92 | topViewNibName:@
93 | bottomViewNibName:@];
94 |
95 | FTFoldComponent *foldComponentB = [[FTFoldComponent alloc]initWithSuperView:self
96 | topViewNibName:@
97 | bottomViewNibName:@];
98 |
99 | return @[foldComponentA,foldComponentB];
100 | }
101 |
102 | /* please refer to FTAnimationContext interface to get the
103 | full list of possible configuration parameters */
104 |
105 | -(void)configureAnimationContext:(FTAnimationContext *)animationContext{
106 |
107 | animationContext.expandAnimationDuration = 0.6f;
108 | animationContext.collapseAnimationDuration = 0.6f;
109 | animationContext.foldAngleFinalValue = - M_PI/6;
110 | animationContext.animationMediaTimingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
111 | }
112 | ```
113 |
114 | At this point you have `FTAnimationView` that is ready to be used in your UI.
115 | Continue with steps 3 - 7 if you need to integrate it into the `UITableView` component.
116 |
117 | ## Usage with UITableView:
118 |
119 | 3. Subclass `FTTableCell` and create cell prototype.
120 | You can create as many different cells as you need in order to fulfill your UI tasks.
121 |
122 | 3.1 Press '⌘ + N'. Create new subclass of `UITableViewCell`. Tick "Also create XIB file".
123 | 3.2 Open .h file of your class. Change parent class to `FTTableCell` like this:
124 | ```objective-c
125 | @interface : FTTableCell
126 | ```
127 | 3.3 Open and edit cell xib according to your needs: (add UI components, setup Autolayout).
128 | 3.4 Create data model object to manage UI components of your cell if any required.
129 | 3.5 Set cell identifier.
130 |
131 |
132 | 4. Configure each subclassed `FTTableCell` with `FTAnimationView` and `FTTableCellSeparator` overriding following methods in `FTTableCell`:
133 |
134 | ```objective-c
135 | -(FTAnimationView *)submitAnimationView{
136 | return [[ alloc]init];
137 | }
138 |
139 |
140 | /* do not override if you need cell without separator */
141 | -(FTTableCellSeparator *)submitCellSeparator{
142 | return [[FTTableCellSeparator alloc]initWithHeight:1.0f
143 | offsetFromCellLeftEdge:0.0f
144 | offsetFromCellRightEdge:0.0f
145 | color:[UIColor colorWithRed:92.0f/255.0f green:94.0f/255.0f blue:102.0f/255.0f alpha:0.1f]];
146 | }
147 | ```
148 |
149 |
150 | 5. Subclass and configure `FTTableModel`.
151 | `FTTableModel` is responsible for the architecture of your table view: which cells are used and in which order. It can manage `FTTableCell` and `UITableViewCell` cells in any combinations.
152 |
153 | Override the following methods in `FTTableModel`:
154 |
155 | ```objective-c
156 | -(NSDictionary *)submitCellsIDs{
157 |
158 | return @{@"":@""};
159 |
160 | }
161 |
162 | /* Submit your table architecture. In this example, the table consists only of cells of one type. You can implement any custom architecture combining different cell types for different rows */
163 |
164 | -(NSArray *)submitTableCellsMetadata{
165 |
166 | NSMutableArray *cellsMetadata = [[NSMutableArray alloc]init];
167 |
168 | for (NSInteger i = 0; i < kNumberOfCellsInTable; i++) {
169 |
170 | FTTableCellMetadata *tableCellMetadata = nil;
171 |
172 | tableCellMetadata = [[FTTableCellMetadata alloc]initWithReuseID:@"" isExpandable:YES isExpanded:NO];
173 |
174 | [cellsMetadata addObject:tableCellMetadata];
175 | }
176 |
177 | return cellsMetadata;
178 | }
179 | ```
180 |
181 | 6. Add TableView UI component to your controller in the storyboard.
182 |
183 | 6.1 Configure your TableView UI component.
184 | 6.2 Set `FTTableView` as the custom class for your table (in storyboard settings).
185 |
186 |
187 | 7. Subclass and configure `FTTableViewController`.
188 | `FTTableViewController` bridges `FTTableView` with `FTTableModel` and provides other logic to manage cells operations.
189 |
190 | 7.1 In your subclassed `FTTableViewController`, link your `FTTableView` and subscribe for `UITableViewDelegate` and `UITableViewDataSource` protocols. Example:
191 |
192 | ```objective-c
193 | self.tableView.dataSource = self;
194 | self.tableView.delegate = self;
195 | ```
196 |
197 | 7.2 Override the following methods in your subclassed `FTTableViewController`:
198 |
199 | ```objective-c
200 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
201 | return [super tableView:tableView numberOfRowsInSection:section];
202 | }
203 |
204 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
205 | return [super tableView:tableView cellForRowAtIndexPath:indexPath];
206 | }
207 |
208 | -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
209 | return [super tableView:tableView heightForRowAtIndexPath:indexPath];
210 | }
211 |
212 | -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
213 | [self updateDisplayedDataForCell:cell atIndexPath:indexPath];
214 | }
215 | ```
216 |
217 | 7.3 Implement your data model to manage the content of your cells.
218 | 7.4 Implement mechanism to update the content of your cells using your data model.
219 | You can override `-(void)tableView: willDisplayCell: forRowAtIndexPath:` for that purpose.
220 |
221 |
222 | ## License
223 | This project is licensed under the MIT License - see the LICENSE.md file for details
224 |
--------------------------------------------------------------------------------
/_Pods.xcodeproj:
--------------------------------------------------------------------------------
1 | Example/Pods/Pods.xcodeproj
--------------------------------------------------------------------------------