How to set the alpha of an UIImage in SWIFT programmatically?

Luckily I was able to help myself and would like to share with you my solution: Swift 3 // UIImage+Alpha.swift extension UIImage { func alpha(_ value:CGFloat) -> UIImage { UIGraphicsBeginImageContextWithOptions(size, false, scale) draw(at: CGPoint.zero, blendMode: .normal, alpha: value) let newImage = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() return newImage! } } The above new Swift extension I added to … Read more

SwiftUI – Add Border to One Edge of an Image

Demo Implementation You can use this modifier on any View: .border(width: 5, edges: [.top, .leading], color: .yellow) With the help of this simple extension: extension View { func border(width: CGFloat, edges: [Edge], color: Color) -> some View { overlay(EdgeBorder(width: width, edges: edges).foregroundColor(color)) } } And here is the magic struct behind this: struct EdgeBorder: Shape … Read more

Crop UIImage to fit a frame image

In Interface Builder, use the following configuration: There are two important settings, namely: Mode: Aspect Fill Clip Subviews It can also be done programmatically: [imageView setContentMode:UIViewContentModeScaleAspectFill]; [imageView setClipsToBounds:YES]; This will correctly fill the view with the image, keep its aspect ratio and hide what doesn’t fit.

How to get UIImage of AppIcon?

The problem is that the AppIcon from the asset catalog is not placed in the the catalog after compiling. Instated it it copied into your apps bundle, just like before. The name conversion used when copying the icon to the app bundle is AppIcon<size>.png, where the size is for example 40×40 or 72×72 You can … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)