Post

Replies

Boosts

Views

Activity

Umbrella Header [...].h not found
When trying to build my framework, I suddenly receive the following error: Umbrella Header [...].h not found Honestly, I'm not even sure why there should be a header file in the first place since the framework is pure swift. There are no objective-c files in the project at all. I don't have an idea where to begin the investigation for this issue since I haven't really used objective-c ever and am therefore not too familiar with the topic. Can someone here maybe point me in the right direction?
0
0
1k
Nov ’22
Objective C App has wrong [UIScreen mainScreen].bounds value since iOS 16
Device: Physical iPhone X (16.0.2) A legacy app (Objective C) of my client has worked just fine on iOS 15. On iOS 16 though, the app has suddenly 'shrunken in height'. The app opens as usual but on the top and bottom of the screen, there are black bars, as the app itself seems to be constrained to a certain size. After some investigation, I found out that the device actually reports its Screen Height to be 480pt (iPhone X). Forcing the UIWindow to have a different size doesn't solve the issue, the app is still constrained to be the same wrong height. It seems the device 'actually believes' to be shorter than it is. Since this behavior kind of resembles what happens when starting an iPhone app on an iPad (at least I remember seeing something like that some time ago), I was wondering whether or not this behavior is expected as of iOS 16? If not, I would really appreciate some help here.
6
1
1.3k
Sep ’22
Why would i not activate 'Preserve Vector Data' for SVGs?
First off, i believe i do know what the option 'Preserve Vector Data' does. But just in case, let me recap: When using PDFs or SVGs in my Asset Catalog, Xcode by default creates assets at fixed sizes from these files at buildtime. When i tick the 'Preserve Vector Data' box, the asset is scaled at runtime using the vector data, allowing for smooth scaling and crisp images at any scale. But the question i'm asking myself now is what exactly is the drawback - most likely performance-wise - to simply activating this option for each an every SVG or PDF Asset i use in my project? I would be very happy if someone could elaborate on this or direct me to some more in-depth documentation on Vector Assets :)
2
2
3.3k
Nov ’21
UICollectionViewDiffableDataSource cellProvider called more often than expected
I'm using the UICollectionViewDiffableDataSource to populate my UICollectionView. After receiving a list of items via REST API, I create a new snapshot and apply it like this: DispatchQueue.main.async { &#9; var snapshot = NSDiffableDataSourceSnapshot<RegionSection, DiffableModel>() &#9; snapshot.appendSections(RegionSection.allCases) &#9; snapshot.appendItems(self.spotlights, toSection: .Spotlights) &#9; snapshot.appendItems(self.vendors, toSection: .Vendors) &#9; self.dataSource?.apply(snapshot, animatingDifferences: animated) } When setting up my cells in the cellProvider, I asynchronously load images from a URL. I noticed, that the first cell would frantically flick through all the images that are loaded and end up displaying a different image than it was supposed to. (For example the image intended to be displayed by the last cell). I decided to investigate and figured out that the cellProvider closure is called twice as many times as expected. Also the collectionView.dequeueReusableCell function behaves weirdly for the first half of the calls as it returns the same cell each time even though there are no cells in the collectionView that could be dequeued. My cellProvider closure: dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { (collectionView, indexPath, entry) -> UICollectionViewCell? in &#9;&#9;if let spotlight = entry as? Spotlight{ &#9;&#9;&#9;&#9;let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "spotlightCell", for: indexPath) as! SpotlightCell &#9;&#9;&#9;&#9; &#9;&#9;&#9;&#9;cell.nameLabel.text = spotlight.title &#9;&#9;&#9;&#9;cell.subtitleLabel.text = spotlight.subtitle &#9;&#9;&#9;&#9;cell.categoryLabel.text = spotlight.type.getDescription().uppercased() &#9;&#9;&#9;&#9;cell.imageView.loadImage(fromUrl: spotlight.titlePictureUrl) &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; &#9;&#9;&#9;&#9;return cell &#9;&#9;}else if let vendor = entry as? Vendor{ &#9;&#9;&#9;&#9;let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "vendorCell", for: indexPath) as! VendorCell &#9;&#9;&#9;&#9; &#9;&#9;&#9;&#9;cell.nameLabel.text = vendor.title &#9;&#9;&#9;&#9;cell.assortmentLabel.text = vendor.assortmentDescription &#9;&#9;&#9;&#9;cell.imageView.loadImage(fromUrl: vendor.titlePictureUrl ?? vendor.pictureUrls?.first ?? "") &#9;&#9;&#9;&#9; &#9;&#9;&#9;&#9;if let distance = vendor.distance{ &#9;&#9;&#9;&#9;&#9;&#9;cell.distanceLabel.text = (distance/1000) < 1 ? (distance.getReadableString(withDecimalSeparator: ",", andDecimalCount: 0) + "m entfernt") : ((distance/1000).getReadableString(withDecimalSeparator: ",", andDecimalCount: 0) + "km entfernt") &#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; &#9;&#9;&#9;&#9;return cell &#9;&#9;} &#9;&#9;return nil } Here is an example: I create a snapshot containing 4 vendor entries (For simplicity I didn't add anything in the other section for this example) The cellProvider is called 4 times (for each indexPath and entry) and the cell that is dequeued is the same one each time. The cellProvider is called another 4 times (again, for each indexPath and entry) and this time the cells are different each time. For each time the cellProvider is invoked I call loadImage, which tries to find an image for the URL in my image cache and if it cannot found one loads it asynchronously. Since all calls happen almost simultaneously every image is loaded twice and the first cell displays one image after another until the last of the 4 URLSessions it initiated returns. I can't imagine it is expected behaviour for the dataSource to call it's cellProvider closure that often and I simply can't figure out why this happens or find anything in the documentation on this. I hope someone can explain to me why this happens and in case this is expected behaviour how to properly set up cells with asynchronous image loading using a DiffableDataSource.
1
0
1.1k
Dec ’20