Skip to content

Commit

Permalink
add-nib-examples: added segment and switch cells
Browse files Browse the repository at this point in the history
  • Loading branch information
maxim-eremenko committed Feb 15, 2017
1 parent 589acba commit a4937da
Show file tree
Hide file tree
Showing 12 changed files with 227 additions and 11 deletions.
52 changes: 48 additions & 4 deletions Example/Alister-Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
objects = {

/* Begin PBXBuildFile section */
1809B5491E54BF9B001DAF53 /* ANETableXibSegmentCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1809B5431E54BF9B001DAF53 /* ANETableXibSegmentCell.m */; };
1809B54A1E54BF9B001DAF53 /* ANETableXibSegmentCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1809B5441E54BF9B001DAF53 /* ANETableXibSegmentCell.xib */; };
1809B54B1E54BF9B001DAF53 /* ANETableXibSwitchCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1809B5471E54BF9B001DAF53 /* ANETableXibSwitchCell.m */; };
1809B54C1E54BF9B001DAF53 /* ANETableXibSwitchCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1809B5481E54BF9B001DAF53 /* ANETableXibSwitchCell.xib */; };
1809B54F1E54C0C7001DAF53 /* ANETableXibSegmentCellViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 1809B54E1E54C0C7001DAF53 /* ANETableXibSegmentCellViewModel.m */; };
1809B5521E54C0DA001DAF53 /* ANETableXibSwitchCellViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 1809B5511E54C0DA001DAF53 /* ANETableXibSwitchCellViewModel.m */; };
1841F2421DEC70CA00FE2999 /* ANAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1841F1FD1DEC70CA00FE2999 /* ANAppDelegate.m */; };
1841F2431DEC70CA00FE2999 /* ANECustomFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1841F2001DEC70CA00FE2999 /* ANECustomFooterView.m */; };
1841F2441DEC70CA00FE2999 /* ANECustomFooterViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 1841F2021DEC70CA00FE2999 /* ANECustomFooterViewModel.m */; };
Expand Down Expand Up @@ -136,7 +142,6 @@
D7A21E041DA895B500D6D803 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D7A21DEC1DA895B500D6D803 /* InfoPlist.strings */; };
D7A21E051DA895B500D6D803 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D7A21DEE1DA895B500D6D803 /* main.m */; };
FA541DA71E546244008DB951 /* ANEListViewsNibSupportVC.m in Sources */ = {isa = PBXBuildFile; fileRef = FA541DA61E546244008DB951 /* ANEListViewsNibSupportVC.m */; };
FA541DAA1E5464F9008DB951 /* ANETableXibCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = FA541DA91E5464F9008DB951 /* ANETableXibCell.xib */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -160,6 +165,16 @@
019F2C73D93E6032B674EAE3 /* Pods-Alister-Example-Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Alister-Example-Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Alister-Example-Tests/Pods-Alister-Example-Tests.debug.xcconfig"; sourceTree = "<group>"; };
07CE62481D5169B300D1A43C /* Tests-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = "<group>"; };
12C7B2C3A579D51E17C98434 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
1809B5421E54BF9B001DAF53 /* ANETableXibSegmentCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANETableXibSegmentCell.h; sourceTree = "<group>"; };
1809B5431E54BF9B001DAF53 /* ANETableXibSegmentCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ANETableXibSegmentCell.m; sourceTree = "<group>"; };
1809B5441E54BF9B001DAF53 /* ANETableXibSegmentCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ANETableXibSegmentCell.xib; sourceTree = "<group>"; };
1809B5461E54BF9B001DAF53 /* ANETableXibSwitchCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANETableXibSwitchCell.h; sourceTree = "<group>"; };
1809B5471E54BF9B001DAF53 /* ANETableXibSwitchCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ANETableXibSwitchCell.m; sourceTree = "<group>"; };
1809B5481E54BF9B001DAF53 /* ANETableXibSwitchCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ANETableXibSwitchCell.xib; sourceTree = "<group>"; };
1809B54D1E54C0C7001DAF53 /* ANETableXibSegmentCellViewModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANETableXibSegmentCellViewModel.h; sourceTree = "<group>"; };
1809B54E1E54C0C7001DAF53 /* ANETableXibSegmentCellViewModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ANETableXibSegmentCellViewModel.m; sourceTree = "<group>"; };
1809B5501E54C0DA001DAF53 /* ANETableXibSwitchCellViewModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANETableXibSwitchCellViewModel.h; sourceTree = "<group>"; };
1809B5511E54C0DA001DAF53 /* ANETableXibSwitchCellViewModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ANETableXibSwitchCellViewModel.m; sourceTree = "<group>"; };
1841F1FC1DEC70CA00FE2999 /* ANAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANAppDelegate.h; sourceTree = "<group>"; };
1841F1FD1DEC70CA00FE2999 /* ANAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ANAppDelegate.m; sourceTree = "<group>"; };
1841F1FF1DEC70CA00FE2999 /* ANECustomFooterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANECustomFooterView.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -399,7 +414,6 @@
F94C3A38CF0AB0BC1BBB034E /* Pods-Alister-Example-Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Alister-Example-Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-Alister-Example-Tests/Pods-Alister-Example-Tests.release.xcconfig"; sourceTree = "<group>"; };
FA541DA51E546244008DB951 /* ANEListViewsNibSupportVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANEListViewsNibSupportVC.h; sourceTree = "<group>"; };
FA541DA61E546244008DB951 /* ANEListViewsNibSupportVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ANEListViewsNibSupportVC.m; sourceTree = "<group>"; };
FA541DA91E5464F9008DB951 /* ANETableXibCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ANETableXibCell.xib; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -433,6 +447,30 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
1809B5411E54BF9B001DAF53 /* SegmentCell */ = {
isa = PBXGroup;
children = (
1809B5421E54BF9B001DAF53 /* ANETableXibSegmentCell.h */,
1809B5431E54BF9B001DAF53 /* ANETableXibSegmentCell.m */,
1809B5441E54BF9B001DAF53 /* ANETableXibSegmentCell.xib */,
1809B54D1E54C0C7001DAF53 /* ANETableXibSegmentCellViewModel.h */,
1809B54E1E54C0C7001DAF53 /* ANETableXibSegmentCellViewModel.m */,
);
path = SegmentCell;
sourceTree = "<group>";
};
1809B5451E54BF9B001DAF53 /* SwitchCell */ = {
isa = PBXGroup;
children = (
1809B5461E54BF9B001DAF53 /* ANETableXibSwitchCell.h */,
1809B5471E54BF9B001DAF53 /* ANETableXibSwitchCell.m */,
1809B5481E54BF9B001DAF53 /* ANETableXibSwitchCell.xib */,
1809B5501E54C0DA001DAF53 /* ANETableXibSwitchCellViewModel.h */,
1809B5511E54C0DA001DAF53 /* ANETableXibSwitchCellViewModel.m */,
);
path = SwitchCell;
sourceTree = "<group>";
};
1841F1FB1DEC70CA00FE2999 /* AppDelegate */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1451,7 +1489,8 @@
FA541DA81E54649B008DB951 /* Views */ = {
isa = PBXGroup;
children = (
FA541DA91E5464F9008DB951 /* ANETableXibCell.xib */,
1809B5411E54BF9B001DAF53 /* SegmentCell */,
1809B5451E54BF9B001DAF53 /* SwitchCell */,
);
path = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -1594,8 +1633,9 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1809B54A1E54BF9B001DAF53 /* ANETableXibSegmentCell.xib in Resources */,
1809B54C1E54BF9B001DAF53 /* ANETableXibSwitchCell.xib in Resources */,
D7A21E041DA895B500D6D803 /* InfoPlist.strings in Resources */,
FA541DAA1E5464F9008DB951 /* ANETableXibCell.xib in Resources */,
1841F2521DEC70CA00FE2999 /* Localizable.strings in Resources */,
D795BA071DA7253400668587 /* StyleSettings.plist in Resources */,
D7A21E031DA895B500D6D803 /* Assets.xcassets in Resources */,
Expand Down Expand Up @@ -1878,6 +1918,7 @@
D75F9E791DC982940070538F /* ANListControllerSearchManager.m in Sources */,
D75F9E771DC982940070538F /* ANTableController.m in Sources */,
1841F2481DEC70CA00FE2999 /* ANEDataGenerator.m in Sources */,
1809B5491E54BF9B001DAF53 /* ANETableXibSegmentCell.m in Sources */,
1841F24E1DEC70CA00FE2999 /* ANECollectionHeaderView.m in Sources */,
1841F24C1DEC70CA00FE2999 /* ANECollectionCustomSupplementaryVC.m in Sources */,
D75F9E811DC982940070538F /* ANBaseTableFooterView.m in Sources */,
Expand All @@ -1898,6 +1939,7 @@
1841F2511DEC70CA00FE2999 /* ANEDefaultSupplementaryVC.m in Sources */,
1841F2451DEC70CA00FE2999 /* ANECustomHeaderView.m in Sources */,
D75F9E7F1DC982940070538F /* ANBaseTableViewCell.m in Sources */,
1809B54F1E54C0C7001DAF53 /* ANETableXibSegmentCellViewModel.m in Sources */,
D75F9E701DC982940070538F /* ANListController.m in Sources */,
1841F24F1DEC70CA00FE2999 /* ANECustomSupplementaryController.m in Sources */,
1841F2491DEC70CA00FE2999 /* ANEBottomStickedFooterVC.m in Sources */,
Expand All @@ -1914,10 +1956,12 @@
D75F9E871DC982940070538F /* ANStorageUpdateOperation.m in Sources */,
D75F9E831DC982940070538F /* ANStorageMovedIndexPathModel.m in Sources */,
D75F9E7B1DC982940070538F /* ANCollectionViewCell.m in Sources */,
1809B5521E54C0DA001DAF53 /* ANETableXibSwitchCellViewModel.m in Sources */,
FA541DA71E546244008DB951 /* ANEListViewsNibSupportVC.m in Sources */,
D75F9E6F1DC982940070538F /* ANTableUpdateConfigurationModel.m in Sources */,
D75F9E861DC982940070538F /* ANStorageUpdateModel.m in Sources */,
1841F2561DEC70CA00FE2999 /* ANECollectionViewCell.m in Sources */,
1809B54B1E54BF9B001DAF53 /* ANETableXibSwitchCell.m in Sources */,
D74623161DD5277200099D0A /* ANStorageDebugDataGenerator.m in Sources */,
D75F9E7A1DC982940070538F /* ANCollectionReusableView.m in Sources */,
1841F2431DEC70CA00FE2999 /* ANECustomFooterView.m in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#import "ANStorage.h"
#import "ANTableView.h"
#import "ANTableController.h"
#import "ANBaseTableViewCell.h"
#import "ANETableXibSwitchCell.h"
#import "ANETableXibSegmentCell.h"

@interface ANEListViewsNibSupportVC ()

Expand All @@ -33,8 +34,14 @@ - (instancetype)init
[self.tableController attachStorage:self.storage];
[self.tableController configureCellsWithBlock:^(id<ANListControllerReusableInterface> configurator) {

UINib* nib = [UINib nibWithNibName:@"ANETableXibCell" bundle:nil];
[configurator registerCellWithNib:nib forModelClass:[NSNumber class]];
UINib* xibCellNib = [UINib nibWithNibName:@"ANETableXibSwitchCell" bundle:nil];
UINib* segmentCellNib = [UINib nibWithNibName:@"ANETableXibSegmentCell" bundle:nil];

[configurator registerCellWithNib:xibCellNib
forModelClass:[ANETableXibSwitchCellViewModel class]];

[configurator registerCellWithNib:segmentCellNib
forModelClass:[ANETableXibSegmentCellViewModel class]];
}];
}

Expand All @@ -50,7 +57,12 @@ - (void)viewDidLoad
{
[super viewDidLoad];
[self.storage updateWithoutAnimationChangeBlock:^(id<ANStorageUpdatableInterface> storageController) {
[storageController addItem:@2];

ANETableXibSwitchCellViewModel* switchModel = [ANETableXibSwitchCellViewModel new];
ANETableXibSegmentCellViewModel* segmentModel = [ANETableXibSegmentCellViewModel new];

[storageController addItem:switchModel];
[storageController addItem:segmentModel];
}];
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// ANETableXibSegmentCell.h
// Alister-Example
//
// Created by ANODA on 2/15/17.
// Copyright © 2017 Oksana Kovalchuk. All rights reserved.
//

#import "ANBaseTableViewCell.h"
#import "ANETableXibSegmentCellViewModel.h"

@interface ANETableXibSegmentCell : ANBaseTableViewCell

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// ANETableXibSegmentCell.m
// Alister-Example
//
// Created by ANODA on 2/15/17.
// Copyright © 2017 Oksana Kovalchuk. All rights reserved.
//

#import "ANETableXibSegmentCell.h"

@interface ANETableXibSegmentCell ()

@property (weak, nonatomic) IBOutlet UISegmentedControl* segmentControl;

@end

@implementation ANETableXibSegmentCell

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16B2555" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="ANETableXibSegmentCellViewModel&lt;=&gt;kANDefaultCellKind" rowHeight="113" id="rky-uT-t5M" customClass="ANETableXibSegmentCell">
<rect key="frame" x="0.0" y="0.0" width="428" height="113"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="rky-uT-t5M" id="2eH-oT-zKu">
<rect key="frame" x="0.0" y="0.0" width="428" height="112"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="l9Q-7t-yQK">
<rect key="frame" x="134" y="42" width="160" height="29"/>
<constraints>
<constraint firstAttribute="width" constant="160" id="9PU-9n-68L"/>
</constraints>
<segments>
<segment title="On"/>
<segment title="Off"/>
</segments>
</segmentedControl>
</subviews>
<constraints>
<constraint firstItem="l9Q-7t-yQK" firstAttribute="centerX" secondItem="2eH-oT-zKu" secondAttribute="centerX" id="SZB-lt-iIX"/>
<constraint firstItem="l9Q-7t-yQK" firstAttribute="centerY" secondItem="2eH-oT-zKu" secondAttribute="centerY" id="vT0-cK-Y43"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="segmentControl" destination="l9Q-7t-yQK" id="lFP-nY-Xnr"/>
</connections>
<point key="canvasLocation" x="130" y="867.5"/>
</tableViewCell>
</objects>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// ANETableXibSegmentCellViewModel.h
// Alister-Example
//
// Created by ANODA on 2/15/17.
// Copyright © 2017 Oksana Kovalchuk. All rights reserved.
//

@interface ANETableXibSegmentCellViewModel : NSObject

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// ANETableXibSegmentCellViewModel.m
// Alister-Example
//
// Created by ANODA on 2/15/17.
// Copyright © 2017 Oksana Kovalchuk. All rights reserved.
//

#import "ANETableXibSegmentCellViewModel.h"

@implementation ANETableXibSegmentCellViewModel

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// ANETableXibSwitchCell.h
// Alister-Example
//
// Created by ANODA on 2/15/17.
// Copyright © 2017 Oksana Kovalchuk. All rights reserved.
//

#import "ANBaseTableViewCell.h"
#import "ANETableXibSwitchCellViewModel.h"

@interface ANETableXibSwitchCell : ANBaseTableViewCell

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// ANETableXibSwitchCell.m
// Alister-Example
//
// Created by ANODA on 2/15/17.
// Copyright © 2017 Oksana Kovalchuk. All rights reserved.
//

#import "ANETableXibSwitchCell.h"

@interface ANETableXibSwitchCell ()

@property (weak, nonatomic) IBOutlet UISwitch* switchControl;

@end

@implementation ANETableXibSwitchCell

@end
Loading

0 comments on commit a4937da

Please sign in to comment.