Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Commit

Permalink
Added prototype cell reuse identifier to quell warning.
Browse files Browse the repository at this point in the history
Fixed missing missing voids from block prototypes.
Fixed weakSelf to strongSelf dance in blocks.
Updated project for Xcode 9.0.
  • Loading branch information
jabobier-microsoft authored and Jason Bobier committed Oct 3, 2017
1 parent 93e66e9 commit 5d32484
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 25 deletions.
24 changes: 21 additions & 3 deletions YMSwipeTableViewCell.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
EA7F769F1B8E6E7000184BAE /* YMTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = EA7F769E1B8E6E7000184BAE /* YMTableViewCell.m */; };
EA7F76A21B8FBAD900184BAE /* YMOneButtonSwipeView.m in Sources */ = {isa = PBXBuildFile; fileRef = EA7F76A11B8FBAD900184BAE /* YMOneButtonSwipeView.m */; };
EA7F76AB1B9A343F00184BAE /* UITableViewCell+Swipe.m in Sources */ = {isa = PBXBuildFile; fileRef = EA7F76AA1B9A343F00184BAE /* UITableViewCell+Swipe.m */; };
EA9CB5FC1BD5897000046187 /* YMSwipeTableViewCell.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA9CB5F21BD5897000046187 /* YMSwipeTableViewCell.framework */; settings = {ASSET_TAGS = (); }; };
EA9CB5FC1BD5897000046187 /* YMSwipeTableViewCell.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA9CB5F21BD5897000046187 /* YMSwipeTableViewCell.framework */; };
EA9CB6071BD5897000046187 /* YMSwipeTableViewCell.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA9CB5F21BD5897000046187 /* YMSwipeTableViewCell.framework */; };
EA9CB6081BD5897000046187 /* YMSwipeTableViewCell.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EA9CB5F21BD5897000046187 /* YMSwipeTableViewCell.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
EA9CB6101BD58A7E00046187 /* UITableViewCell+Swipe.m in Sources */ = {isa = PBXBuildFile; fileRef = EA7F76AA1B9A343F00184BAE /* UITableViewCell+Swipe.m */; settings = {ASSET_TAGS = (); }; };
EA9CB6101BD58A7E00046187 /* UITableViewCell+Swipe.m in Sources */ = {isa = PBXBuildFile; fileRef = EA7F76AA1B9A343F00184BAE /* UITableViewCell+Swipe.m */; };
EA9CB6111BD58A8600046187 /* UITableViewCell+Swipe.h in Headers */ = {isa = PBXBuildFile; fileRef = EA7F76A91B9A343F00184BAE /* UITableViewCell+Swipe.h */; settings = {ATTRIBUTES = (Public, ); }; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -303,7 +303,7 @@
EA7F765B1B7A977D00184BAE /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0700;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = Microsoft;
TargetAttributes = {
EA7F76621B7A977D00184BAE = {
Expand Down Expand Up @@ -460,13 +460,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand Down Expand Up @@ -505,13 +513,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand Down Expand Up @@ -596,6 +612,7 @@
EA9CB6091BD5897000046187 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEFINES_MODULE = YES;
Expand All @@ -618,6 +635,7 @@
EA9CB60A1BD5897000046187 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -36,6 +37,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
21 changes: 14 additions & 7 deletions YMSwipeTableViewCell/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="8xv-IT-2CB">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="8xv-IT-2CB">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--YMSwipeTableViewCell-->
<scene sceneID="2Ca-dX-vfj">
<objects>
<tableViewController id="lm7-Ms-4z8" customClass="ViewController" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="8dS-Dc-K5v">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="MgZ-XA-qo6">
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="YMSwipeTableViewCellIdentifier" id="MgZ-XA-qo6">
<rect key="frame" x="0.0" y="22" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="MgZ-XA-qo6" id="o5N-0V-JaO">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
Expand All @@ -36,7 +43,7 @@
<objects>
<navigationController id="8xv-IT-2CB" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="xov-Nq-euZ">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
Expand Down
36 changes: 22 additions & 14 deletions YMSwipeTableViewCell/PodFiles/UITableViewCell+Swipe.m
Original file line number Diff line number Diff line change
Expand Up @@ -416,23 +416,31 @@ - (void)goToCurrentSwipeMode:(void (^)(BOOL finished))completion withAnimation:(
CATransform3D transform = [self transformForMode:mode];

__weak typeof(self) weakSelf = self;
void(^goToCurrentSwipeModeActionBlock)() = ^{
[weakSelf.swipeView.layer setTransform:transform];
if (weakSelf.swipeEffect == YATableSwipeEffectTrail) {
weakSelf.leftView.layer.transform = weakSelf.swipeView.layer.transform;
weakSelf.rightView.layer.transform = weakSelf.swipeView.layer.transform;
void(^goToCurrentSwipeModeActionBlock)(void) = ^{
__strong typeof(self) strongSelf = weakSelf;

if (strongSelf) {
[strongSelf.swipeView.layer setTransform:transform];
if (strongSelf.swipeEffect == YATableSwipeEffectTrail) {
strongSelf.leftView.layer.transform = strongSelf.swipeView.layer.transform;
strongSelf.rightView.layer.transform = strongSelf.swipeView.layer.transform;
}
}
};

void(^goToCurrentSwipeModeCompletionActionBlock)() = ^{
if (mode == YATableSwipeModeDefault) {
[weakSelf.swipeContainerView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
[weakSelf.swipeContainerView removeFromSuperview];
[weakSelf.swipeView removeFromSuperview];
weakSelf.swipeView = nil;
}
if (weakSelf.modeChangedBlock) {
weakSelf.modeChangedBlock(weakSelf, mode);
void(^goToCurrentSwipeModeCompletionActionBlock)(void) = ^{
__strong typeof(self) strongSelf = weakSelf;

if (strongSelf) {
if (mode == YATableSwipeModeDefault) {
[strongSelf.swipeContainerView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
[strongSelf.swipeContainerView removeFromSuperview];
[strongSelf.swipeView removeFromSuperview];
strongSelf.swipeView = nil;
}
if (strongSelf.modeChangedBlock) {
strongSelf.modeChangedBlock(strongSelf, mode);
}
}
};

Expand Down

0 comments on commit 5d32484

Please sign in to comment.