iPhone CoreGraphics Mask?

I am making a mask for a winterboard theme, and found this article: How to Mask an Image

It gives the code for the masking, and I have made my mask. However, I was wondering where do I put the code for it? I'm guesing it is in the System/Library/CoreServices file but I don't really know what it is and don't want to screw up some Core Services (it sounds important).

Does anyone know how to use it?

BTW the code is:
- (UIImage*) maskImage🙁UIImage *)image withMask🙁UIImage *)maskImage {

CGImageRef maskRef = maskImage.CGImage;

CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef),
CGImageGetHeight(maskRef),
CGImageGetBitsPerComponent(maskRef),
CGImageGetBitsPerPixel(maskRef),
CGImageGetBytesPerRow(maskRef),
CGImageGetDataProvider(maskRef), NULL, false);

CGImageRef masked = CGImageCreateWithMask([image CGImage], mask);
return [UIImage imageWithCGImage:masked];

}

Original thread: https://forums.imore.com/threads/iphone-coregraphics-mask.186857/