●EXPO 58 — Expo is still on expo@58.0.25 (11/12), with no newer release yet●RORK — The rork.com changelog still shows 9/29 as its latest entry●GEMINI 2.5 — gemini-2.5-flash and pro shut down on the API on 12/1, 14 days left. Allow for review time if model names ship in your app●AGE RANGE — Developers ask how to tell apart the three new iOS 27 age-range errors in their apps●WATERMARK — Claude-generated text carries a watermark from 11/16; worth checking if your app ships AI-written copy●NEW — Turning Off cameraPermission Broke QR Scanning●EXPO 58 — Expo is still on expo@58.0.25 (11/12), with no newer release yet●RORK — The rork.com changelog still shows 9/29 as its latest entry●GEMINI 2.5 — gemini-2.5-flash and pro shut down on the API on 12/1, 14 days left. Allow for review time if model names ship in your app●AGE RANGE — Developers ask how to tell apart the three new iOS 27 age-range errors in their apps●WATERMARK — Claude-generated text carries a watermark from 11/16; worth checking if your app ships AI-written copy●NEW — Turning Off cameraPermission Broke QR Scanning
Reading Rork Max's SwiftUI Generation Through a Wallpaper App's Requirements — What to Trust, What to Fix, What to Write by Hand
Typical wallpaper-app requirements — grid, pinch-zoom, slideshow, photo-library permission, ads, in-app purchase — handed to Rork Max's SwiftUI generation: where the output tends to hold up and where it tends to break. For the memory failure that bites first, this note includes decode-time downsampling, a bounded cache, and a procedure for measuring on your own device.
A generated wallpaper grid runs smoothly in the simulator. Push production-size images through it on a real device, keep scrolling, and after a while it dies.
How a screen looks and how it behaves after running for a long time have to be checked separately.
This is an implementation note that imagines handing the typical requirements of a wallpaper app to Rork Max's SwiftUI generation, and sorts the result into what you can trust, what you should always review, and what is safer to write by hand.
Trust generated code up to the visual skeleton, and check with your own eyes the behavior that only shows up as time passes. The rest of the article is organized around that sentence.
Assumptions, and What This Article Has Not Verified
The scope first.
Generated output changes with the prompt and from day to day. When I write that generated code "tends to look like this," I mean patterns that commonly appear when building a wallpaper app in SwiftUI. It is not a guarantee about the output of any specific version. The code shown is an excerpt meant to convey structure and reasoning, and I have not built it as of this writing. Run it through your own compiler and a real device before you rely on it.
The only numbers included are ones you can check by calculation, such as the bitmap size of one image. Per-device measurements are left to the procedure later in the article, so you can take them in your own environment.
What You Can Use As-Is — The Visual Skeleton
Wallpaper Grid (LazyVGrid)
A requirement like "three columns, square cells, rounded corners, tap to go full screen, load more at the end" fits LazyVGrid well, and the skeleton usually comes out cleanly.
struct WallpaperGridView: View { @StateObject private var viewModel = WallpaperViewModel() let columns = [GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible())] var body: some View { ScrollView { LazyVGrid(columns: columns, spacing: 4) { ForEach(viewModel.wallpapers) { wallpaper in WallpaperCell(wallpaper: wallpaper) .onAppear { viewModel.loadMoreIfNeeded(current: wallpaper) } } } .padding(4) } .onAppear { viewModel.fetchWallpapers() } }}struct WallpaperCell: View { let wallpaper: Wallpaper @State private var showDetail = false var body: some View { AsyncImage(url: URL(string: wallpaper.thumbnailURL)) { image in image.resizable().aspectRatio(1, contentMode: .fill) } placeholder: { Color.gray.opacity(0.3) } .clipShape(RoundedRectangle(cornerRadius: 8)) .onTapGesture { showDetail = true } .fullScreenCover(isPresented: $showDetail) { WallpaperDetailView(wallpaper: wallpaper) } }}
Pagination triggered from onAppear is the standard approach. The ViewModel details — offset management, error handling, suppressing duplicate loads — stay thin unless the requirement mentions them, so you add those yourself.
Only the structure earns the label "usable as-is," though. What happens when AsyncImage meets production-size images is covered in the memory section below.
Full-Screen Preview (Pinch-to-Zoom)
A full-screen viewer with pinch-to-zoom and a close button also comes out cleanly as a skeleton.
struct WallpaperDetailView: View { let wallpaper: Wallpaper @State private var scale: CGFloat = 1.0 @State private var lastScale: CGFloat = 1.0 @Environment(\.dismiss) private var dismiss var body: some View { ZStack(alignment: .topTrailing) { AsyncImage(url: URL(string: wallpaper.fullURL)) { image in image .resizable() .aspectRatio(contentMode: .fit) .frame(maxWidth: .infinity, maxHeight: .infinity) .scaleEffect(scale) .gesture( MagnifyGesture() .onChanged { value in scale = lastScale * value.magnification } .onEnded { _ in scale = min(max(scale, 1.0), 5.0) lastScale = scale } ) } placeholder: { ProgressView().frame(maxWidth: .infinity, maxHeight: .infinity) } .background(Color.black) .ignoresSafeArea() Button(action: { dismiss() }) { Image(systemName: "xmark.circle.fill") .font(.title) .foregroundColor(.white) .padding() } } }}
Two points deserve a look.
The first is the gesture type. MagnificationGesture was deprecated in iOS 17, and MagnifyGesture (whose value exposes value.magnification) replaces it. If you support iOS 16 or earlier, keep the old type or branch with #available.
The second is the zoom limits. Clamping only in onEnded lets the scale leave the range during the pinch itself. For a smoother feel, also clamp with min/max inside onChanged.
✦
Thank you for reading this far.
Continue Reading
What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.
WHAT YOU'LL LEARN
✦Sort the typical features of a wallpaper app into what to leave to generation, what to review, and what is safer to write by hand
✦Get review points for the behavior you cannot see on screen: Timer lifecycle, photo-library permission, and ATT ordering
✦Learn the fix for the memory failure that generated code hits first with production data — decode-time downsampling plus a bounded cache — and how to measure it on your own device
Secure payment via Stripe · Cancel anytime
✦
Unlock This Article
Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.
What Needs a Hand — It Runs, but the Assumptions Do Not Match
Category Tabs (When TabView Fits)
A category view such as "Nature," "Architecture," and "Abstract" will often come back as a TabView. TabView itself is a correct choice. But when each tab holds a list of high-resolution images, it is worth profiling when each tab's content actually gets initialized.
If you want tab content built only when shown, attaching the reason to the prompt communicates the intent better.
Make category switching build only the list for the selected category.
Reason: every category holds a grid of high-resolution images, so keeping
the hidden categories alive at the same time puts pressure on memory.
Adding "why" to "what to build" tends to point the output in the right direction.
Slideshow and Timer
An auto-advancing slideshow shows its quality in how it handles Timer. In generated code, check these three points in particular:
Whether the Timer started in onAppear is stopped in onDisappear.
Whether it stops when the app moves to the background.
Whether it avoids starting twice on return.
If any is missing, the timer keeps running after the screen disappears, or advances at double speed after returning. Writing start and stop symmetrically and watching foreground and background through scenePhase is the safe shape.
final class SlideShowTimer: ObservableObject { private var timer: Timer? func start(interval: TimeInterval, action: @escaping () -> Void) { stop() // guard against double starts timer = Timer.scheduledTimer(withTimeInterval: interval, repeats: true) { _ in action() } } func stop() { timer?.invalidate() timer = nil } deinit { timer?.invalidate() }}struct SlideShowView: View { @StateObject private var slideTimer = SlideShowTimer() @Environment(\.scenePhase) private var scenePhase @State private var currentIndex = 0 let wallpapers: [Wallpaper] var body: some View { TabView(selection: $currentIndex) { ForEach(wallpapers.indices, id: \.self) { index in WallpaperFullView(wallpaper: wallpapers[index]).tag(index) } } .tabViewStyle(.page(indexDisplayMode: .never)) .onAppear { startSlideShow() } .onDisappear { slideTimer.stop() } .onChange(of: scenePhase) { _, phase in // two-parameter form, iOS 17+ if phase == .active { startSlideShow() } else { slideTimer.stop() } } } private func startSlideShow() { guard !wallpapers.isEmpty else { return } slideTimer.start(interval: 3.0) { withAnimation { currentIndex = (currentIndex + 1) % wallpapers.count } } }}
WallpaperFullView is a placeholder for your own full-screen view. The wallpapers.isEmpty guard is there because computing % 0 on an empty array crashes.
You can also write this with Timer.publish and onReceive. Whichever you pick, the thing to check is whether every start has a matching stop.
Safer to Write by Hand — OS Permissions and Ordering
Saving to the Photo Library and the Permission Flow
Saving an image to Photos is central to a wallpaper app. One caution: iOS has no public API for an app to set the home-screen or lock-screen wallpaper directly. What most wallpaper apps actually do is save the image to the photo library and guide the user through the setup steps. Let the wording of a button labeled "Set as wallpaper" reflect honestly what it does.
Before saving, check the add-only permission with async/await.
import Photosfunc requestPhotoLibraryAccess() async -> Bool { let status = PHPhotoLibrary.authorizationStatus(for: .addOnly) switch status { case .authorized, .limited: return true case .notDetermined: let granted = await PHPhotoLibrary.requestAuthorization(for: .addOnly) return granted == .authorized || granted == .limited default: return false }}
What generated code tends to miss is the path for .denied and .restricted. Proceeding straight to the save without permission makes the failure disappear silently. Include in the specification either a hand-off to the Settings app or a visible explanation. Do not forget NSPhotoLibraryAddUsageDescription in Info.plist.
ATT (App Tracking Transparency) Ordering
In an app that shows ads, the timing of the tracking-permission dialog affects both review and revenue. Google's AdMob documentation describes a flow in which the ATT request comes before the ads SDK is initialized. Check the official guide for the SDK version you actually ship, to confirm the currently recommended order.
When you receive generated code, confirm these three points:
That ads-SDK initialization has not started before ATTrackingManager.requestTrackingAuthorization is called.
That the call happens in a state where the dialog can appear, such as after applicationDidBecomeActive, rather than immediately at launch.
That NSUserTrackingUsageDescription exists in Info.plist.
You cannot notice this from how the screen looks, and it tends to surface in review or in production. Put it at the top of your review list.
Checklist Before Implementing (Guidance for Sorting)
Here is the content so far, reordered as review priorities.
Area
What to expect from generation
What to check in review
Grid, transitions, animation
The skeleton usually comes out cleanly
Image decode size, caching, duplicate loads
Timers and async work
Runs, but cleanup is easy to miss
Start/stop symmetry, background, double starts
Photo, ATT, and notification permissions
The flow tends to be rough
Denied-state path, Info.plist, call order
Ads and purchases
The basic shape appears, edge cases are thin
Current SDK API, refunds, restore
Device resolution constants
Newest models are sometimes missing
Cross-check against official specs
The less visible the behavior, the more review time generated code deserves. That is the sorting criterion.
Notes on Embedding an Ad Banner
When you put an AdMob banner in a generated view, the point to watch is how you obtain rootViewController.
struct BannerAdView: UIViewRepresentable { let adUnitID: String func makeUIView(context: Context) -> GADBannerView { let banner = GADBannerView(adSize: GADAdSizeBanner) banner.adUnitID = adUnitID // keyWindow is deprecated since iOS 13; go through the scene instead banner.rootViewController = UIApplication.shared.connectedScenes .compactMap { $0 as? UIWindowScene } .flatMap { $0.windows } .first(where: { $0.isKeyWindow })?.rootViewController banner.load(GADRequest()) return banner } func updateUIView(_ uiView: GADBannerView, context: Context) {}}
UIApplication.shared.keyWindow was deprecated in iOS 13. If it remains in generated code, change it to go through connectedScenes.
One more thing. The Google Mobile Ads SDK renames types across major versions (in newer generations GADBannerView has become BannerView). Check that generated code is not using old names by comparing it with the release notes of the SDK you adopt. It is also safer to build a mechanism that prevents mixing up test ad unit IDs and release ones.
Device Resolution Constants — Newest Models Slip Through
A wallpaper app often serves images matched to each device's screen resolution, so constants need updating whenever a new model appears. Generated code can write the basic branching but may not include the dimensions of newer models.
// Example: pick the wallpaper size to serve from the screen's pixel size// Verify the numbers against Apple's Tech Specs before updatingstruct WallpaperSize { static func optimal(for screen: UIScreen = .main) -> CGSize { let native = screen.nativeBounds.size // in pixels, independent of rotation switch (Int(native.width), Int(native.height)) { case (1320, 2868): return CGSize(width: 1320, height: 2868) // 16 Pro Max / 17 Pro Max case (1290, 2796): return CGSize(width: 1290, height: 2796) // 14 Pro Max / 15 Plus / 15 Pro Max / 16 Plus case (1206, 2622): return CGSize(width: 1206, height: 2622) // 16 Pro / 17 / 17 Pro case (1179, 2556): return CGSize(width: 1179, height: 2556) // 15 / 15 Pro / 16 default: return native } }}
UIScreen.main is on its way out as of iOS 16, so passing in the window scene's screen makes later fixes easier. Using nativeBounds saves you from writing the scale arithmetic yourself.
The mapping between model names and pixel sizes is information that keeps changing. Do not copy the table verbatim; confirm against Apple's official specifications. You can also rethink the design of splitting images by exact size, and have the server fall back to the nearest size, as the default branch does.
Generated Code Breaks First on Memory
I said earlier that the LazyVGrid skeleton comes out cleanly. But point AsyncImage at production wallpaper data and the configuration tends to end in a forced termination as you keep scrolling.
The reason is simple. AsyncImage decodes a downloaded image at its original size. If you serve original-size wallpapers as thumbnails, each decoded bitmap occupies "width × height × 4 bytes." For 1290×2796 that is about 14.4MB per image. With 30 images alive across the surrounding rows of a three-column grid, that alone comes to more than 400MB. There is no guarantee that LazyVGrid releases off-screen cells immediately, and AsyncImage has no explicit cache, so scrolling back can trigger another download and another decode.
This is not Rork Max's fault. The requirement "three-column grid" does not tell it that original-size 4K images will be flowing in. That is territory the person writing the specification has to fill in.
Decide the Decode Size First
The countermeasure is to shrink at the decode stage. CGImageSourceCreateThumbnailAtIndex expands an image straight to the target size without ever creating the full-size bitmap.
import ImageIOimport UIKitenum ImageDownsampler { /// Returns a UIImage downsampled at decode time, from the display size (points) and scale static func downsample(data: Data, to pointSize: CGSize, scale: CGFloat) -> UIImage? { let sourceOptions = [kCGImageSourceShouldCache: false] as CFDictionary guard let source = CGImageSourceCreateWithData(data as CFData, sourceOptions) else { return nil } let maxPixel = max(pointSize.width, pointSize.height) * scale let thumbOptions = [ kCGImageSourceCreateThumbnailFromImageAlways: true, kCGImageSourceShouldCacheImmediately: true, kCGImageSourceCreateThumbnailWithTransform: true, kCGImageSourceThumbnailMaxPixelSize: maxPixel ] as CFDictionary guard let cgImage = CGImageSourceCreateThumbnailAtIndex(source, 0, thumbOptions) else { return nil } return UIImage(cgImage: cgImage, scale: scale, orientation: .up) }}
kCGImageSourceCreateThumbnailFromImageAlways is set to true so that the small thumbnail embedded in a JPEG is not reused. For a wallpaper grid, an embedded thumbnail tends to look soft at the edges. Setting kCGImageSourceShouldCacheImmediately to true completes the decode inside this function, which avoids a late decode on the main thread during scrolling.
Put a Bounded Cache in Front
Next is the cache. With totalCostLimit set, NSCache lets go of old entries under memory pressure. The point is to pass the byte count as the cost.
actor ThumbnailStore { static let shared = ThumbnailStore() private let cache: NSCache<NSString, UIImage> = { let c = NSCache<NSString, UIImage>() c.totalCostLimit = 48 * 1024 * 1024 // 48MB return c }() private var inFlight: [String: Task<UIImage?, Never>] = [:] func thumbnail(for url: URL, pointSize: CGSize, scale: CGFloat) async -> UIImage? { let key = "\(url.absoluteString)|\(Int(pointSize.width * scale))" if let cached = cache.object(forKey: key as NSString) { return cached } if let running = inFlight[key] { return await running.value } let task = Task<UIImage?, Never> { guard let (data, _) = try? await URLSession.shared.data(from: url) else { return nil } return ImageDownsampler.downsample(data: data, to: pointSize, scale: scale) } inFlight[key] = task let image = await task.value inFlight[key] = nil if let image, let cg = image.cgImage { cache.setObject(image, forKey: key as NSString, cost: cg.bytesPerRow * cg.height) } return image }}
The reason for holding inFlight is to coalesce overlapping requests for the same URL into one. When you scroll a grid quickly, loading for the same cell starts many times. Written naively, decoding of the same image runs in parallel and the memory peak jumps.
On the calling side, wrap it in a thin view that replaces AsyncImage.
struct WallpaperThumbnail: View { let url: URL let side: CGFloat @State private var image: UIImage? var body: some View { Group { if let image { Image(uiImage: image).resizable().aspectRatio(1, contentMode: .fill) } else { Color.gray.opacity(0.3) } } .frame(width: side, height: side) .clipped() .task(id: url) { image = await ThumbnailStore.shared.thumbnail( for: url, pointSize: CGSize(width: side, height: side), scale: UIScreen.main.scale ) } }}
.task(id: url) matters quietly. With a task started from onAppear, a stale load can remain when a cell is reused. A task with an id cancels the previous load as soon as the id changes.
A Procedure for Checking with Numbers
So you do not stop at "I think I fixed it," here is a way to read the remaining memory as a number. os_proc_available_memory() returns, in bytes, how much the app can still use before it is terminated.
#if DEBUGimport osfunc logMemoryHeadroom(_ label: String) { let available = Double(os_proc_available_memory()) / 1_048_576 os_log("[mem] %{public}@ available=%{public}.1fMB", label, available)}#endif
The recording procedure is as follows.
On a real device (ideally an older model with little memory), keep scrolling the grid through 200 rows.
Call logMemoryHeadroom every few rows and note the minimum remaining value.
Repeat the same operation in three configurations: generated code as-is, downsampling only, and downsampling plus cache.
Check in Xcode's Instruments (Allocations / VM Tracker) that the same trend appears.
The absolute values vary widely with device, image size, and data volume. What to look at is not the absolute value but the size of the difference when you change the configuration.
There is a cost. Shrinking at the decode stage increases CPU time. As long as it runs inside a Task it should rarely get in the way of scrolling, but on older devices you may need to limit concurrency.
Change How You Hand Over the Specification
You can also change how you write the request. Instead of passing only "a three-column grid," add conditions like these.
A three-column grid. Images are delivered at original 4K size, so downsample at decode time to the cell's display size.
Give it a bounded cache, and coalesce parallel loads of the same URL into one.
Writing the constraints and the reasons makes output with downsampling and caching built in more likely. There is no guarantee it happens every time, though. Review after receiving the code cannot be skipped.
Animation — An Area Where the Skeleton Is Easy to Hand Off
Standard animations such as fade-in, scale-up, and slide-in tend to come back as well-formed code even from light instructions. For a like button that bounces a heart on tap, this is the basic shape.
The spring parameters (response around 0.3, dampingFraction around 0.5 to 0.6) are values you tune to taste for how bouncy it feels. What to confirm is whether an empty withAnimation block has been left behind, and whether the state being animated actually changes. Generated code can contain statements that contribute nothing to the motion.
Mixing with UIKit — Migrate in Stages
When adding SwiftUI screens to an existing UIKit app, the basic move is to embed SwiftUI views into the UIKit flow with UIHostingController. If navigation ends up doubled between NavigationStack and UINavigationController, consistency of back actions and transitions breaks easily.
A comfortable way to proceed is to build new screens in SwiftUI and leave existing UIKit screens alone. There is no need to rebuild every screen at once.
Handing data across the boundary is where generated code built around @State and @Binding fits poorly. For the bridging part with a Coordinator in UIViewControllerRepresentable, writing it by hand or reusing a pattern you have already confirmed works is safer.
StoreKit 2 — Do Not Forget the Refund Check
Building purchases on StoreKit 2 is the current standard. That Apple recommends StoreKit 2 can be confirmed in the official documentation. For a non-consumable purchase such as "remove ads," the check iterates over Transaction.currentEntitlements.
actor BillingManager { static let shared = BillingManager() func isAdFree() async -> Bool { for await result in Transaction.currentEntitlements { if case .verified(let transaction) = result, transaction.productID == "com.example.app.adfree", transaction.revocationDate == nil { return true } } return false }}
Replace com.example.app.adfree with your own product ID. The line to confirm is revocationDate == nil. Without it, features stay unlocked even for purchases that were refunded. Always check whether generated code is missing it. If the ad-display decision combines purchase state with something like a temporary unlock from rewarded ads, putting the decision into a single method makes gaps less likely.
Measuring How You Spend Your Time
The effect of bringing in generation is best seen in your own project's numbers, not by feel. Recording these three things lets you look back later.
Note the time per screen to generate, and the time to review and fix.
Count the kinds of defects found in review (lifecycle, permissions, memory, outdated APIs).
Write down separately whether rework came from how the requirement was written or from the quality of generation.
Counting defect types shows, in the language of your own project, which row of the sorting table above deserves more of your time.
Summary — The Work Outside Generation
The visual skeleton is an area where you can save time by leaving it to generation. Timer cleanup, asynchronous permission handling, memory-aware structure, and the edge cases of purchases, on the other hand, are where "code that looks like it works" deserves time-consuming verification.
Responsibility for generated code rests with whoever ships the app. If you can tell what to trust from what to doubt, generation stops being a drag on quality and becomes a tool that covers what you would overlook.
As a first step, pick one small screen in an existing app and review the generated code with this article's checklist in hand. Within an hour you should be able to see where to hand things off and where to add your own checks.
Share
Thank You for Reading
Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.