Post

Replies

Boosts

Views

Activity

How can I add a folder to my app's bundle
In previous Xcode versions, it was possible to add a folder reference to a project, and in the copy resources build phase it would copy the folder the bundle, rather than the contents (i.e. the folder's contents would be nested inside a directory named after the folder). In Xcode 16.4, when creating a folder reference, the copy resources build phase will copy the contents of the folder to the bundle at the root level (not nested), like the old behavior when creating a group rather than a folder reference. If you look at the raw project.pbxproj file, it shows up as a "File System Synchronized Root Group" rather than a "File Reference". Is there a way to get the old behavior, aside from hand-editing the project.pbxproj file?
1
0
45
May ’25
How to fix MainActor warning for QLPreviewControllerDelegate
I'm currently migrating a midsize (20k LOC) project to Swift structured concurrency. With complete checking turned on, it currently builds with only two warnings, both of which are related to the QLPreviewControllerDelegate protocol: "Main actor-isolated instance method 'previewControllerDidDismiss' cannot be used to satisfy nonisolated protocol requirement; this is an error in the Swift 6 language mode" as well as the same warning but substituting 'previewController(_:transitionViewFor:)' for the method name. I'm confused as to how to make these nonisolated, as they use UIKit classes/subclasses as arguments and/or return types.
2
0
645
Nov ’24
Expose a Swift initializer as an Objective-C factory constructor
I'm creating a compatibility layer for a new Swift implementation of a legacy Objective-C library. The Objective-C library has a class whose only constructor is a factory constructor: (instancetype)fooWithBar:(NSString *)bar; I know that when bridging from Objective-C to Swift the factory constructors are turned into convenience initializers. But I'm trying to do the reverse, that is create a factory constructor for a Swift class. The convenience initializer gets turned into something along the lines of: (instancetype)initWithBar:(NSString *)bar; So my approach is to create a static method in Swift that returns an instance of Self: @objc static func foo(bar: String) - Self This gets exposed correctly, but I'm a little uneasy since it's clearly asymmetric with the Objective-C - Swift bridging, and also it returns an owned reference, where the Objective-C convention would be that a factory constructor returns an autoreleased object. Long story short, is the static func the way to go, and am I creating a memory leak here? (and if so, how should I fix it?)
1
0
711
Mar ’21
UISegmentedControl segments and VoiceOver
I'm using a UISegmentedControl to ask the user to select from a range of numbers. The start of the range is not necessarily at 1. When using VoiceOver, the segment that is focused reads the accessibilityLabel, followed by the accessibilityTrait ("button"), followed by the numeric position in the control ("x of y"), followed by the accessibilityHint. How can I change the "x of y" that's spoken between the trait and the hint? It's confusing when the user has just selected a segment labeled "10" and hears "ten. button. 11 of 11."
3
0
2.1k
Mar ’21