Relative Content

Tag Archive for swiftswiftuiuikit

How can I share image data between a UIViewController and a Swift UI View?

In my pained search for a way to use AVCapture for camera functionality that saves an image, I found a great YouTube tutorial that used UIKit. Since I wanted to implement this in an app that has been entirely built on SwiftUI, I simply created a HostedViewController struct in a ViewController that contained the code from the UIKit tutorial. This hosting worked (and still works) great in isolation, but my app requires that the captured image be passed to a SwiftUI view (just the default ContentView file). How should I go about this? My initial thought was to pass the image as a binding from the SwiftUI view to the ViewController, but I was struggling to implement this.

How can I share image data between a UIViewController and a Swift UI View?

In my pained search for a way to use AVCapture for camera functionality that saves an image, I found a great YouTube tutorial that used UIKit. Since I wanted to implement this in an app that has been entirely built on SwiftUI, I simply created a HostedViewController struct in a ViewController that contained the code from the UIKit tutorial. This hosting worked (and still works) great in isolation, but my app requires that the captured image be passed to a SwiftUI view (just the default ContentView file). How should I go about this? My initial thought was to pass the image as a binding from the SwiftUI view to the ViewController, but I was struggling to implement this.

UIKit in SwiftUI memory leak while displaying images

I’m using UIKit to display a long list of large images inside a SwiftUI ScrollView and LazyHStack using UIViewControllerRepresentable. When an image is loaded, I’m using SDWebImage to load the image from the disk.

UIKit in SwiftUI memory leak while displaying images

I’m using UIKit to display a long list of large images inside a SwiftUI ScrollView and LazyHStack using UIViewControllerRepresentable. When an image is loaded, I’m using SDWebImage to load the image from the disk.

SwiftUI/UIKit – Make Navigation Bar Buttons and Text Stand Out

In the app I’m currently working on I have a view that displays an associated image at the top. I currently have the image set to ignore the safe area at the top of the screen because I think it gives the app a more modern look. The problem is that all of the buttons or text that are in the navigation bar are unreadable depending on which image is being displayed. Is there a way to give the text shadow or a semitransparent background to make it stand out from the image? Or perhaps is there another design I could be pursuing that also looks very modern and avoids these problems?

Custom dismissable view with scroll view

I’m looking to create a custom SwiftUI view that is overlayed on top of the current view (full screen) and contains a scroll view that allows the user to scroll vertically. When the scroll view is at the top and the user swipes down, the view should slide down & get dismissed (like a normal sheet).