Run CLANGFORMAT on plugins
Summary: This diff runs CLANGFORMAT lint on plugins. I have added CLANGFORMAT as the lint engined for objc files in xplat/sonar. Right now the iOS folder is not formatted according to CLANGFORMAT. Ran `arc lint -a --paths-cmd "find ./iOS/Plugins -type f" --verbose` Reviewed By: passy Differential Revision: D19942173 fbshipit-source-id: 8b975b0a344df073b02d69cd1f9ee5629af2799d
This commit is contained in:
committed by
Facebook Github Bot
parent
a19a430eee
commit
e8b20d5b15
@@ -7,9 +7,8 @@
|
||||
|
||||
#import "SKTapListenerMock.h"
|
||||
|
||||
@implementation SKTapListenerMock
|
||||
{
|
||||
NSMutableArray<SKTapReceiver> *_tapReceivers;
|
||||
@implementation SKTapListenerMock {
|
||||
NSMutableArray<SKTapReceiver>* _tapReceivers;
|
||||
}
|
||||
|
||||
@synthesize isMounted;
|
||||
@@ -23,7 +22,7 @@
|
||||
}
|
||||
|
||||
- (void)listenForTapWithBlock:(SKTapReceiver)receiver {
|
||||
[_tapReceivers addObject: receiver];
|
||||
[_tapReceivers addObject:receiver];
|
||||
}
|
||||
|
||||
- (void)tapAt:(CGPoint)point {
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
#if FB_SONARKIT_ENABLED
|
||||
|
||||
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
|
||||
#import <FlipperKitLayoutPlugin/SKDescriptorMapper.h>
|
||||
#import <FlipperKitLayoutPlugin/SKNodeDescriptor.h>
|
||||
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
|
||||
#import <FlipperKitTestUtils/FlipperConnectionMock.h>
|
||||
#import <FlipperKitTestUtils/FlipperResponderMock.h>
|
||||
|
||||
@@ -22,9 +22,8 @@
|
||||
@interface SonarKitLayoutPluginTests : XCTestCase
|
||||
@end
|
||||
|
||||
@implementation SonarKitLayoutPluginTests
|
||||
{
|
||||
SKDescriptorMapper *_descriptorMapper;
|
||||
@implementation SonarKitLayoutPluginTests {
|
||||
SKDescriptorMapper* _descriptorMapper;
|
||||
}
|
||||
|
||||
- (void)setUp {
|
||||
@@ -32,217 +31,235 @@
|
||||
|
||||
_descriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
|
||||
|
||||
[_descriptorMapper registerDescriptor: [TestNodeDescriptor new]
|
||||
forClass: [TestNode class]];
|
||||
[_descriptorMapper registerDescriptor:[TestNodeDescriptor new]
|
||||
forClass:[TestNode class]];
|
||||
}
|
||||
|
||||
- (void)testGetRoot {
|
||||
FlipperKitLayoutPlugin *plugin = [[FlipperKitLayoutPlugin alloc]
|
||||
initWithRootNode: [[TestNode alloc] initWithName: @"rootNode"]
|
||||
withTapListener: nil
|
||||
withDescriptorMapper: _descriptorMapper];
|
||||
FlipperKitLayoutPlugin* plugin = [[FlipperKitLayoutPlugin alloc]
|
||||
initWithRootNode:[[TestNode alloc] initWithName:@"rootNode"]
|
||||
withTapListener:nil
|
||||
withDescriptorMapper:_descriptorMapper];
|
||||
|
||||
FlipperConnectionMock *connection = [FlipperConnectionMock new];
|
||||
FlipperResponderMock *responder = [FlipperResponderMock new];
|
||||
FlipperConnectionMock* connection = [FlipperConnectionMock new];
|
||||
FlipperResponderMock* responder = [FlipperResponderMock new];
|
||||
[plugin didConnect:connection];
|
||||
|
||||
SonarReceiver receiver = connection.receivers[@"getRoot"];
|
||||
receiver(@{}, responder);
|
||||
|
||||
XCTAssertTrue(([responder.successes containsObject: @{
|
||||
@"id": @"rootNode",
|
||||
@"name": @"TestNode",
|
||||
@"children": @[],
|
||||
@"attributes": @[],
|
||||
@"data": @{},
|
||||
@"decoration": @"",
|
||||
}]));
|
||||
XCTAssertTrue(([responder.successes containsObject:@{
|
||||
@"id" : @"rootNode",
|
||||
@"name" : @"TestNode",
|
||||
@"children" : @[],
|
||||
@"attributes" : @[],
|
||||
@"data" : @{},
|
||||
@"decoration" : @"",
|
||||
}]));
|
||||
}
|
||||
|
||||
- (void)testGetEmptyNodes {
|
||||
FlipperKitLayoutPlugin *plugin = [FlipperKitLayoutPlugin new];
|
||||
FlipperConnectionMock *connection = [FlipperConnectionMock new];
|
||||
FlipperResponderMock *responder = [FlipperResponderMock new];
|
||||
FlipperKitLayoutPlugin* plugin = [FlipperKitLayoutPlugin new];
|
||||
FlipperConnectionMock* connection = [FlipperConnectionMock new];
|
||||
FlipperResponderMock* responder = [FlipperResponderMock new];
|
||||
[plugin didConnect:connection];
|
||||
|
||||
SonarReceiver receiver = connection.receivers[@"getNodes"];
|
||||
receiver(@{@"ids": @[]}, responder);
|
||||
receiver(@{@"ids" : @[]}, responder);
|
||||
|
||||
XCTAssertTrue(([responder.successes containsObject:@{@"elements": @[]}]));
|
||||
XCTAssertTrue(([responder.successes containsObject:@{@"elements" : @[]}]));
|
||||
}
|
||||
|
||||
- (void)testGetNodes {
|
||||
TestNode *rootNode = [[TestNode alloc] initWithName: @"rootNode"];
|
||||
NSArray *childNodes = @[
|
||||
[[TestNode alloc] initWithName: @"testNode1"],
|
||||
[[TestNode alloc] initWithName: @"testNode2"],
|
||||
[[TestNode alloc] initWithName: @"testNode3"],
|
||||
];
|
||||
TestNode* rootNode = [[TestNode alloc] initWithName:@"rootNode"];
|
||||
NSArray* childNodes = @[
|
||||
[[TestNode alloc] initWithName:@"testNode1"],
|
||||
[[TestNode alloc] initWithName:@"testNode2"],
|
||||
[[TestNode alloc] initWithName:@"testNode3"],
|
||||
];
|
||||
|
||||
rootNode.children = childNodes;
|
||||
|
||||
FlipperKitLayoutPlugin *plugin = [[FlipperKitLayoutPlugin alloc] initWithRootNode: rootNode
|
||||
withTapListener: nil
|
||||
withDescriptorMapper: _descriptorMapper];
|
||||
FlipperKitLayoutPlugin* plugin =
|
||||
[[FlipperKitLayoutPlugin alloc] initWithRootNode:rootNode
|
||||
withTapListener:nil
|
||||
withDescriptorMapper:_descriptorMapper];
|
||||
|
||||
FlipperConnectionMock *connection = [FlipperConnectionMock new];
|
||||
FlipperResponderMock *responder = [FlipperResponderMock new];
|
||||
FlipperConnectionMock* connection = [FlipperConnectionMock new];
|
||||
FlipperResponderMock* responder = [FlipperResponderMock new];
|
||||
[plugin didConnect:connection];
|
||||
|
||||
// Ensure that nodes are tracked
|
||||
connection.receivers[@"getRoot"](@{}, responder);
|
||||
|
||||
SonarReceiver receiver = connection.receivers[@"getNodes"];
|
||||
receiver(@{@"ids": @[ @"testNode1", @"testNode2", @"testNode3" ]}, responder);
|
||||
receiver(
|
||||
@{@"ids" : @[ @"testNode1", @"testNode2", @"testNode3" ]}, responder);
|
||||
|
||||
XCTAssertTrue(([responder.successes containsObject:@{@"elements": @[
|
||||
@{
|
||||
@"id": @"testNode1",
|
||||
@"name": @"TestNode",
|
||||
@"children": @[],
|
||||
@"attributes": @[],
|
||||
@"data": @{},
|
||||
@"decoration": @"",
|
||||
},
|
||||
@{
|
||||
@"id": @"testNode2",
|
||||
@"name": @"TestNode",
|
||||
@"children": @[],
|
||||
@"attributes": @[],
|
||||
@"data": @{},
|
||||
@"decoration": @"",
|
||||
},
|
||||
@{
|
||||
@"id": @"testNode3",
|
||||
@"name": @"TestNode",
|
||||
@"children": @[],
|
||||
@"attributes": @[],
|
||||
@"data": @{},
|
||||
@"decoration": @"",
|
||||
},
|
||||
]}]));
|
||||
XCTAssertTrue(([responder.successes containsObject:@{
|
||||
@"elements" : @[
|
||||
@{
|
||||
@"id" : @"testNode1",
|
||||
@"name" : @"TestNode",
|
||||
@"children" : @[],
|
||||
@"attributes" : @[],
|
||||
@"data" : @{},
|
||||
@"decoration" : @"",
|
||||
},
|
||||
@{
|
||||
@"id" : @"testNode2",
|
||||
@"name" : @"TestNode",
|
||||
@"children" : @[],
|
||||
@"attributes" : @[],
|
||||
@"data" : @{},
|
||||
@"decoration" : @"",
|
||||
},
|
||||
@{
|
||||
@"id" : @"testNode3",
|
||||
@"name" : @"TestNode",
|
||||
@"children" : @[],
|
||||
@"attributes" : @[],
|
||||
@"data" : @{},
|
||||
@"decoration" : @"",
|
||||
},
|
||||
]
|
||||
}]));
|
||||
}
|
||||
|
||||
- (void)testSetHighlighted {
|
||||
TestNode *rootNode = [[TestNode alloc] initWithName: @"rootNode"];
|
||||
TestNode* rootNode = [[TestNode alloc] initWithName:@"rootNode"];
|
||||
|
||||
TestNode *testNode1 = [[TestNode alloc] initWithName: @"testNode1"];
|
||||
TestNode *testNode2 = [[TestNode alloc] initWithName: @"testNode2"];
|
||||
NSArray *childNodes = @[ testNode1, testNode2 ];
|
||||
TestNode* testNode1 = [[TestNode alloc] initWithName:@"testNode1"];
|
||||
TestNode* testNode2 = [[TestNode alloc] initWithName:@"testNode2"];
|
||||
NSArray* childNodes = @[ testNode1, testNode2 ];
|
||||
|
||||
rootNode.children = childNodes;
|
||||
|
||||
FlipperKitLayoutPlugin *plugin = [[FlipperKitLayoutPlugin alloc] initWithRootNode: rootNode
|
||||
withTapListener: nil
|
||||
withDescriptorMapper: _descriptorMapper];
|
||||
FlipperKitLayoutPlugin* plugin =
|
||||
[[FlipperKitLayoutPlugin alloc] initWithRootNode:rootNode
|
||||
withTapListener:nil
|
||||
withDescriptorMapper:_descriptorMapper];
|
||||
|
||||
FlipperConnectionMock *connection = [FlipperConnectionMock new];
|
||||
FlipperResponderMock *responder = [FlipperResponderMock new];
|
||||
FlipperConnectionMock* connection = [FlipperConnectionMock new];
|
||||
FlipperResponderMock* responder = [FlipperResponderMock new];
|
||||
[plugin didConnect:connection];
|
||||
|
||||
// Setup in order to track nodes successfully
|
||||
connection.receivers[@"getRoot"](@{}, responder);
|
||||
SonarReceiver getNodesCall = connection.receivers[@"getNodes"];
|
||||
getNodesCall(@{@"ids": @[ @"testNode1", @"testNode2" ]}, responder);
|
||||
getNodesCall(@{@"ids" : @[ @"testNode1", @"testNode2" ]}, responder);
|
||||
|
||||
SonarReceiver setHighlighted = connection.receivers[@"setHighlighted"];
|
||||
setHighlighted(@{@"id":@"testNode2"}, responder);
|
||||
setHighlighted(@{@"id" : @"testNode2"}, responder);
|
||||
|
||||
XCTAssertTrue(testNode2.highlighted);
|
||||
|
||||
setHighlighted(@{@"id":@"testNode1"}, responder);
|
||||
setHighlighted(@{@"id" : @"testNode1"}, responder);
|
||||
|
||||
// Ensure that old highlight was removed
|
||||
XCTAssertTrue(testNode1.highlighted && !testNode2.highlighted);
|
||||
}
|
||||
|
||||
- (void)testSetSearchActive {
|
||||
TestNode *rootNode = [[TestNode alloc] initWithName: @"rootNode"
|
||||
withFrame: CGRectMake(0, 0, 20, 60)];
|
||||
TestNode* rootNode = [[TestNode alloc] initWithName:@"rootNode"
|
||||
withFrame:CGRectMake(0, 0, 20, 60)];
|
||||
|
||||
TestNode *testNode1 = [[TestNode alloc] initWithName: @"testNode1"
|
||||
withFrame: CGRectMake(20, 20, 20, 20)];
|
||||
TestNode *testNode2 = [[TestNode alloc] initWithName: @"testNode2"
|
||||
withFrame: CGRectMake(20, 40, 20, 20)];
|
||||
TestNode *testNode3 = [[TestNode alloc] initWithName: @"testNode3"
|
||||
withFrame: CGRectMake(25, 42, 5, 5)];
|
||||
TestNode* testNode1 =
|
||||
[[TestNode alloc] initWithName:@"testNode1"
|
||||
withFrame:CGRectMake(20, 20, 20, 20)];
|
||||
TestNode* testNode2 =
|
||||
[[TestNode alloc] initWithName:@"testNode2"
|
||||
withFrame:CGRectMake(20, 40, 20, 20)];
|
||||
TestNode* testNode3 =
|
||||
[[TestNode alloc] initWithName:@"testNode3"
|
||||
withFrame:CGRectMake(25, 42, 5, 5)];
|
||||
|
||||
rootNode.children = @[ testNode1, testNode2 ];
|
||||
testNode2.children = @[ testNode3 ];
|
||||
|
||||
SKTapListenerMock *tapListener = [SKTapListenerMock new];
|
||||
FlipperKitLayoutPlugin *plugin = [[FlipperKitLayoutPlugin alloc] initWithRootNode: rootNode
|
||||
withTapListener: tapListener
|
||||
withDescriptorMapper: _descriptorMapper];
|
||||
SKTapListenerMock* tapListener = [SKTapListenerMock new];
|
||||
FlipperKitLayoutPlugin* plugin =
|
||||
[[FlipperKitLayoutPlugin alloc] initWithRootNode:rootNode
|
||||
withTapListener:tapListener
|
||||
withDescriptorMapper:_descriptorMapper];
|
||||
|
||||
FlipperConnectionMock *connection = [FlipperConnectionMock new];
|
||||
FlipperResponderMock *responder = [FlipperResponderMock new];
|
||||
FlipperConnectionMock* connection = [FlipperConnectionMock new];
|
||||
FlipperResponderMock* responder = [FlipperResponderMock new];
|
||||
[plugin didConnect:connection];
|
||||
|
||||
connection.receivers[@"setSearchActive"](@{@"active":@YES}, responder);
|
||||
connection.receivers[@"setSearchActive"](@{@"active" : @YES}, responder);
|
||||
|
||||
// Fake a tap at `testNode3`
|
||||
[tapListener tapAt: (CGPoint){ 26, 43 }];
|
||||
[tapListener tapAt:(CGPoint){26, 43}];
|
||||
|
||||
XCTAssertTrue(([connection.sent[@"select"] containsObject: @{ @"path": @[ @"testNode2", @"testNode3" ] }]));
|
||||
XCTAssertTrue(([connection.sent[@"select"]
|
||||
containsObject:@{@"path" : @[ @"testNode2", @"testNode3" ]}]));
|
||||
}
|
||||
|
||||
- (void)testSetSearchActiveMountAndUnmount {
|
||||
TestNode *rootNode = [[TestNode alloc] initWithName: @"rootNode"];
|
||||
TestNode* rootNode = [[TestNode alloc] initWithName:@"rootNode"];
|
||||
|
||||
SKTapListenerMock *tapListener = [SKTapListenerMock new];
|
||||
FlipperKitLayoutPlugin *plugin = [[FlipperKitLayoutPlugin alloc] initWithRootNode: rootNode
|
||||
withTapListener: tapListener
|
||||
withDescriptorMapper: _descriptorMapper];
|
||||
SKTapListenerMock* tapListener = [SKTapListenerMock new];
|
||||
FlipperKitLayoutPlugin* plugin =
|
||||
[[FlipperKitLayoutPlugin alloc] initWithRootNode:rootNode
|
||||
withTapListener:tapListener
|
||||
withDescriptorMapper:_descriptorMapper];
|
||||
|
||||
FlipperConnectionMock *connection = [FlipperConnectionMock new];
|
||||
FlipperResponderMock *responder = [FlipperResponderMock new];
|
||||
FlipperConnectionMock* connection = [FlipperConnectionMock new];
|
||||
FlipperResponderMock* responder = [FlipperResponderMock new];
|
||||
[plugin didConnect:connection];
|
||||
|
||||
SonarReceiver setSearchActive = connection.receivers[@"setSearchActive"];
|
||||
setSearchActive(@{@"active":@YES}, responder);
|
||||
setSearchActive(@{@"active" : @YES}, responder);
|
||||
|
||||
XCTAssertTrue(tapListener.isMounted);
|
||||
|
||||
setSearchActive(@{@"active":@NO}, responder);
|
||||
XCTAssertTrue(! tapListener.isMounted);
|
||||
setSearchActive(@{@"active" : @NO}, responder);
|
||||
XCTAssertTrue(!tapListener.isMounted);
|
||||
}
|
||||
|
||||
- (void)testSetData {
|
||||
TestNode *rootNode = [[TestNode alloc] initWithName: @"rootNode"
|
||||
withFrame: CGRectMake(0, 0, 20, 60)];
|
||||
TestNode* rootNode = [[TestNode alloc] initWithName:@"rootNode"
|
||||
withFrame:CGRectMake(0, 0, 20, 60)];
|
||||
|
||||
TestNode *testNode1 = [[TestNode alloc] initWithName: @"testNode1"
|
||||
withFrame: CGRectMake(20, 20, 20, 20)];
|
||||
TestNode *testNode2 = [[TestNode alloc] initWithName: @"testNode2"
|
||||
withFrame: CGRectMake(20, 40, 20, 20)];
|
||||
TestNode *testNode3 = [[TestNode alloc] initWithName: @"testNode3"
|
||||
withFrame: CGRectMake(25, 42, 5, 5)];
|
||||
TestNode* testNode1 =
|
||||
[[TestNode alloc] initWithName:@"testNode1"
|
||||
withFrame:CGRectMake(20, 20, 20, 20)];
|
||||
TestNode* testNode2 =
|
||||
[[TestNode alloc] initWithName:@"testNode2"
|
||||
withFrame:CGRectMake(20, 40, 20, 20)];
|
||||
TestNode* testNode3 =
|
||||
[[TestNode alloc] initWithName:@"testNode3"
|
||||
withFrame:CGRectMake(25, 42, 5, 5)];
|
||||
|
||||
rootNode.children = @[ testNode1, testNode2 ];
|
||||
testNode2.children = @[ testNode3 ];
|
||||
|
||||
SKTapListenerMock *tapListener = [SKTapListenerMock new];
|
||||
FlipperKitLayoutPlugin *plugin = [[FlipperKitLayoutPlugin alloc] initWithRootNode: rootNode
|
||||
withTapListener: tapListener
|
||||
withDescriptorMapper: _descriptorMapper];
|
||||
SKTapListenerMock* tapListener = [SKTapListenerMock new];
|
||||
FlipperKitLayoutPlugin* plugin =
|
||||
[[FlipperKitLayoutPlugin alloc] initWithRootNode:rootNode
|
||||
withTapListener:tapListener
|
||||
withDescriptorMapper:_descriptorMapper];
|
||||
|
||||
FlipperConnectionMock *connection = [FlipperConnectionMock new];
|
||||
FlipperResponderMock *responder = [FlipperResponderMock new];
|
||||
FlipperConnectionMock* connection = [FlipperConnectionMock new];
|
||||
FlipperResponderMock* responder = [FlipperResponderMock new];
|
||||
[plugin didConnect:connection];
|
||||
|
||||
// Setup in order to track nodes successfully
|
||||
connection.receivers[@"getRoot"](@{}, responder);
|
||||
connection.receivers[@"getNodes"](@{ @"ids": @[ @"testNode2" ] }, responder);
|
||||
connection.receivers[@"getNodes"](@{@"ids" : @[ @"testNode2" ]}, responder);
|
||||
|
||||
// Modify the name of testNode3
|
||||
connection.receivers[@"setData"](@{
|
||||
@"id": @"testNode3",
|
||||
@"path": @[ @"TestNode", @"name" ],
|
||||
@"value": @"changedNameForTestNode3",
|
||||
}, responder);
|
||||
connection.receivers[@"setData"](
|
||||
@{
|
||||
@"id" : @"testNode3",
|
||||
@"path" : @[ @"TestNode", @"name" ],
|
||||
@"value" : @"changedNameForTestNode3",
|
||||
},
|
||||
responder);
|
||||
|
||||
XCTAssertTrue([testNode3.nodeName isEqualToString: @"changedNameForTestNode3"]);
|
||||
XCTAssertTrue(
|
||||
[testNode3.nodeName isEqualToString:@"changedNameForTestNode3"]);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
|
||||
@interface TestNode : NSObject
|
||||
|
||||
@property (nonatomic, copy) NSString *nodeName;
|
||||
@property (nonatomic, copy) NSArray<TestNode *> *children;
|
||||
@property(nonatomic, copy) NSString* nodeName;
|
||||
@property(nonatomic, copy) NSArray<TestNode*>* children;
|
||||
|
||||
@property (nonatomic, assign) BOOL highlighted;
|
||||
@property (nonatomic, assign) CGRect frame;
|
||||
@property(nonatomic, assign) BOOL highlighted;
|
||||
@property(nonatomic, assign) CGRect frame;
|
||||
|
||||
- (instancetype)initWithName:(NSString *)name;
|
||||
- (instancetype)initWithName:(NSString *)name withFrame:(CGRect)frame;
|
||||
- (instancetype)initWithName:(NSString*)name;
|
||||
- (instancetype)initWithName:(NSString*)name withFrame:(CGRect)frame;
|
||||
|
||||
@end
|
||||
|
||||
@@ -9,12 +9,11 @@
|
||||
|
||||
@implementation TestNode
|
||||
|
||||
- (instancetype)initWithName:(NSString *)name {
|
||||
return [self initWithName: name
|
||||
withFrame: CGRectZero];
|
||||
- (instancetype)initWithName:(NSString*)name {
|
||||
return [self initWithName:name withFrame:CGRectZero];
|
||||
}
|
||||
|
||||
- (instancetype)initWithName:(NSString *)name withFrame:(CGRect)frame {
|
||||
- (instancetype)initWithName:(NSString*)name withFrame:(CGRect)frame {
|
||||
if (self = [super init]) {
|
||||
_nodeName = name;
|
||||
_frame = frame;
|
||||
|
||||
@@ -9,5 +9,5 @@
|
||||
|
||||
#import "TestNode.h"
|
||||
|
||||
@interface TestNodeDescriptor : SKNodeDescriptor<TestNode *>
|
||||
@interface TestNodeDescriptor : SKNodeDescriptor<TestNode*>
|
||||
@end
|
||||
|
||||
@@ -9,27 +9,27 @@
|
||||
|
||||
@implementation TestNodeDescriptor
|
||||
|
||||
- (NSString *)identifierForNode:(TestNode *)node {
|
||||
- (NSString*)identifierForNode:(TestNode*)node {
|
||||
return node.nodeName;
|
||||
}
|
||||
|
||||
- (NSUInteger)childCountForNode:(TestNode *)node {
|
||||
- (NSUInteger)childCountForNode:(TestNode*)node {
|
||||
return [node.children count];
|
||||
}
|
||||
|
||||
- (id)childForNode:(TestNode *)node atIndex:(NSUInteger)index {
|
||||
return [node.children objectAtIndex: index];
|
||||
- (id)childForNode:(TestNode*)node atIndex:(NSUInteger)index {
|
||||
return [node.children objectAtIndex:index];
|
||||
}
|
||||
|
||||
- (void)setHighlighted:(BOOL)highlighted forNode:(TestNode *)node {
|
||||
- (void)setHighlighted:(BOOL)highlighted forNode:(TestNode*)node {
|
||||
node.highlighted = highlighted;
|
||||
}
|
||||
|
||||
- (void)hitTest:(SKTouch *)touch forNode:(TestNode *)node {
|
||||
- (void)hitTest:(SKTouch*)touch forNode:(TestNode*)node {
|
||||
NSUInteger index = [node.children count] - 1;
|
||||
for (TestNode *childNode in [node.children reverseObjectEnumerator]) {
|
||||
if ([touch containedIn: childNode.frame]) {
|
||||
[touch continueWithChildIndex: index withOffset: node.frame.origin];
|
||||
for (TestNode* childNode in [node.children reverseObjectEnumerator]) {
|
||||
if ([touch containedIn:childNode.frame]) {
|
||||
[touch continueWithChildIndex:index withOffset:node.frame.origin];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -39,12 +39,13 @@
|
||||
[touch finish];
|
||||
}
|
||||
|
||||
- (NSDictionary<NSString *, SKNodeUpdateData> *)dataMutationsForNode:(TestNode *)node {
|
||||
return @{
|
||||
@"TestNode.name": ^(NSString *newName) {
|
||||
node.nodeName = newName;
|
||||
}
|
||||
};
|
||||
- (NSDictionary<NSString*, SKNodeUpdateData>*)dataMutationsForNode:
|
||||
(TestNode*)node {
|
||||
return @{@"TestNode.name" : ^(NSString* newName){
|
||||
node.nodeName = newName;
|
||||
}
|
||||
}
|
||||
;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user