Private Boolean: how to install on SKCropNode, with Swift?

SKCropNode works by removing every thing from its vulnerable nodes that are not covered by the original image. This is one type of disguise, the other is to invert this logic and reveal everything that is not covered by the original image.

SKCropNode has a logical switch to set this state, called invertMask , reasonably enough.

What is annoying is that it looks like private .

If you put aside all the approval processes of the application store, the dangers of private APIs, etc. and accept that this is something interesting for testing ... and this is only for testing purposes ...

How to set this invertMask to true using Swift?

UPDATE:

There are other answers to tangentially similar questions:

How to access iOS private APIs in Swift?

However, this does not help me, and is not a direct answer to how to do this to install a boolean, this particular one, in this particular Swift question.

I asked a question about Selectors here and accepted an answer that showed me that I did not need to use or understand Selectors in order to achieve this goal: What is a selector in SKAction: execute (_: onTarget :)

But it seems that for the exact syntax needed to use the selector, you might need to set this boolean to Swift. I do not know what it is or how to do it.

But any other way to install this boolean (in Swift) is certainly fine.

+1
source share
1 answer

According to the latest Xcode 8.1 (build 8B62 with Apple Swift 3.0.1 ), the official SKCropNode.h header is below:

 /** @header Node that can crop its children contents with a mask @copyright 2011 Apple, Inc. All rights reserved. */ #import <SpriteKit/SKNode.h> #import <SpriteKit/SpriteKitBase.h> NS_ASSUME_NONNULL_BEGIN /** A SpriteKit node that masks child nodes using another node alpha component */ SK_EXPORT @interface SKCropNode : SKNode /** SKNode to be used as the mask. The SKNode supplied as the mask must not be a child of another node, but it may have children. Anywhere the mask output alpha component is less than 0.05 masks out that area for the SKCropNode children. If the mask is nil, nothing is masked out. */ @property (nonatomic, retain, nullable) SKNode *maskNode; @end NS_ASSUME_NONNULL_END 

As you can see, there is no presence about invertMask , sorry, but I think this is not possible.

+2
source

Source: https://habr.com/ru/post/1012069/


All Articles