Relative Content

Tag Archive for iosswift

How do I pin an image to the left or right edge of the screen?

I have an image with an aspect ratio similar to the iPhone 15. In my code I use NSLayoutConstraint for image with top, bottom, trailing, leading constraints anchored for device screen sides and adjust the appearance of the image with scaleAspectFill. In this case, I see almost my entire image, regardless of the device. Even when I use the iPhone SE 1st generation, I lose small parts of the image on the left and right sides. But this is a small part (5% of the image) and that suits me. But when I use iPad I lose (30-40% of image) due to different aspect ratio compared to iPhone. So I want to be able to pin the image to the left or right side of the screen when using the iPad. Then I will lose part of the image on only one side. This is the best way for me. But if I try to use NSLayoutConstraint with top, bottom, trailing, leading constraints and adjust the appearance of the image with scaleAspectFill, my image is centered. How to pin an image to the left or right side for iPad?

Swift 6 iOS 18 fix small sheets?

Update to Swift 6 iOS 18 and .sheet is now presented as small compared to previous versions on the iPad. I attempted to fix with the modifier .presentationDetents([.large], selection: $selectedDetent) to set the sheet size .large, but it didn’t work. I’m wondering if there’s an easy way to have the sheets display how they use to.

Problems with SensorKit data calls

The Deligate ‘didFetchResult’ method of fetching data past 24 hours from SensorKit is not being called. It is confirmed that you have already granted full access to the SensorKit and that data on the Ambient value in the device’s personal information -> research sensor & usage data are recorded.

Problems with SensorKit data calls

The Deligate ‘didFetchResult’ method of fetching data past 24 hours from SensorKit is not being called. It is confirmed that you have already granted full access to the SensorKit and that data on the Ambient value in the device’s personal information -> research sensor & usage data are recorded.