Swift

iOS – Obtaining the colour value of a specified pixel in a UIImage

To obtain the color value of a specified pixel in a UIImage, we can use the following code snippet in Swift: This code snippet is an extension of UIImage that adds a method called getPixelColor that takes a CGPoint as an argument and returns a UIColor object that represents the colour of the specified pixel. …

iOS – Obtaining the colour value of a specified pixel in a UIImage Read More »

iOS – How to temporarily disable some libraries in Swift

When writing swift-based software, sometimes you want to disable a library because it does not support your testing environment, but you need to keep the reference of it and the related codes in your project. This can be done by using #canimport macro. Example: This is an elegant way to prevent compile errors while still …

iOS – How to temporarily disable some libraries in Swift Read More »

Scroll to Top