Writing a simple function in Swift for getting UIImage colors is easy and straightforward. To do this, you will need to use the UIImageColors library. This library allows you to get the dominant colors of an image, as well as the complementary colors. To use the library, you will need to import it into your project. Once imported, you can use the getColors() function to get the colors of an image. This function takes in an image and returns an array of colors. With this array, you can access the dominant and complementary colors of the image.