Post

Replies

Boosts

Views

Activity

UIGraphicsImageRenderer memory leak on iOS 18.0
Good morning, when using the following extension I'm getting a memory leak when using Instruments, I've tried capturing self with a weak reference but I still get the leak. public extension UIImage { func resize(_ targetSize: CGSize) -> UIImage { let size = self.size // Calculate the scaling ratios let widthRatio = targetSize.width / size.width let heightRatio = targetSize.height / size.height // Determine the scale factor and size to fill the target size let scaleFactor = max(widthRatio, heightRatio) let scaledImageSize = CGSize( width: size.width * scaleFactor, height: size.height * scaleFactor ) // Calculate the clipping rect let clippingRect = CGRect( x: (scaledImageSize.width - targetSize.width) / 2.0, y: (scaledImageSize.height - targetSize.height) / 2.0, width: targetSize.width, height: targetSize.height ) let format = UIGraphicsImageRendererFormat() format.scale = 1 // Render the clipped image let renderer = UIGraphicsImageRenderer(size: targetSize, format: format) return autoreleasepool { return renderer.image { _ in self.draw(in: CGRect( x: -clippingRect.origin.x, y: -clippingRect.origin.y, width: scaledImageSize.width, height: scaledImageSize.height )) } } } }
2
0
168
3w
reloadInputViews doesn't change from numbers to text
When using reloadInputViews() on a UITextView, if the keyboard is showing emojis it successfully resets to the default text view, but when the keyboard is showing numbers of special characters, it doesn't do anything. Do I have to implement a custom input view in order to achieve this ? I don't want it to resign and become first responder to make it work.
1
0
445
May ’23