Post

Replies

Boosts

Views

Activity

Sonoma 14 & Xcode 14.3.1
I have just upgraded to Sonoma 14. When I launch Xcode 14.3.1 it says I need to update to the latest version and send me to the AppStore where the latest version is 14.3.1? I have beta Xcode 15 installed, but can upload apps compiled with it to the AppStore. What's going on?
5
0
8.8k
Oct ’23
Ventura & XCode
So I installed the latest OS update from Settings not realising that it wasn’t a Monteray update, but Ventura beta. But then when I tried running XCode I get a message that it won’t work with Ventura. So I’m stuck because I was about to release an App, but can’t because the App Store won’t accept stuff built with beta software. So thanks Apple. Of course it’s all my own fault for not reading the Release notes where it is buried in the detail.
0
1
789
Jun ’22
Project Navigator Collapsing all the time
The project navigator in my project keeps collapsing for no apparent reason. I've hunted high and low but can't find a setting to keep it expanded. This is not a new project and the issue began recently after an Xcode upgrade. I am currently using Xcode 15.3 release candidate. If anyone knows how to fix this I'd be very grateful if they could let me know.
6
3
2.2k
Sep ’24
IOS document icon not appearing
I can't get my app's document icon to appear for my document extension. I have tried different ways of configuring it based on Apple's documentation and various solutions posted on the internet. At first I tried adding the icon to the imported type identifier box where it says 'Add imported type identifier icons here' nothing happens when I select an icon (.png) stored in the project. I have checked the info.plist source and there is nothing there. I have since tried editing the source directly. Here are the relevant pieces of my latest attempt. Can anyone tell me where I'm going wrong. Thanks. <key>CFBundleDocumentTypes</key> <array>         <dict>             <key>CFBundleTypeIconFiles</key>             <string>writingshed.png</string>             <key>CFBundleTypeName</key>             <string>Writing Shed Data</string>             <key>LSHandlerRank</key>             <string>Owner</string>             <key>LSItemContentTypes</key>             <array>                 <string>wsd</string>             </array>         </dict> </array> <key>UTExportedTypeDeclarations</key> <array> <dict> <key>UTTypeDescription</key> <string>Writing Shed Data</string> <key>UTTypeIconFiles</key> <array> <string>writingshed.png</string> </array> <key>UTTypeIdentifier</key> <string>WritingShedData</string> <key>UTTypeTagSpecification</key> <dict> <key>public.filename-extension</key> <array> <string>wsd</string> </array> </dict>             <key>UTTypeConformsTo</key>             <array>                 <string>public.data</string>             </array> </dict> </array> <key>UTImportedTypeDeclarations</key> <array> <dict> <key>CFBundleTypeRole</key> <string>Editor</string> <key>UTTypeConformsTo</key> <array/> <key>UTTypeDescription</key> <string>Writing Shed Data</string> <key>UTTypeIconFiles</key> <array> <string>writingshed.png</string> </array> <key>UTTypeIdentifier</key> <string>WritingShedData</string> <key>UTTypeTagSpecification</key> <dict> <key>public.filename-extension</key> <array> <string>wsd</string> </array> </dict> </dict> </array>
1
1
1.4k
Oct ’21
Xcode 15 beta 8 link error
After installing beta 8 I'm suddenly getting the following: ld: warning: building for 'macCatalyst', but linking in dylib (/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa.tbd) built for 'macOS' Any help gratefully received.
1
1
972
Sep ’23
Dynamic type & custom font
If I call let font = UIFont.preferredFont(forTextStyle:.body) Then font.pointSize has value 17 If, however, I call this with a font such as Arial             let font = UIFont.fontWithNameAndTraits(fontName,                                                     size: styleAttributes.fontSize ?? 12,                                                     bold: styleAttributes.bold ?? false,                                                     italic: styleAttributes.italic ?? false)             let fontMetrics = UIFontMetrics(forTextStyle: .body)             let scaledFont = fontMetrics.scaledFont(for: font) Then scaledFont.pointSize has value 12. I was expecting 17, so I must be doing something wrong. Any suggestion? The function fontWithNameAndTraits is:     class func fontWithNameAndTraits(_ name:String, size:CGFloat, bold:Bool, italic:Bool)-UIFont {         let fontRef = UIFont.getFontRefForNameAndTraits(name, size:size, bold:bold, italic:italic)         let fontNameKey = CTFontCopyName(fontRef , kCTFontPostScriptNameKey)! as String         return UIFont(name: fontNameKey as String, size:CTFontGetSize(fontRef ))!     }
1
0
994
Apr ’21
Problem compiling @Model
I tried coding along with the WWDC23 'Dive Deeper into SwiftData' video but can't get the sample code to compile. For example the Card class fails with lots of errors associated with @Model. The first of these is: Type 'Card' does not conform to protocol 'PersistentModel' import SwiftUI import SwiftData @Model final class Card { var front: String var back: String var creationDate: Date init(front: String, back: String, creationDate: Date = .now) { self.front = front self.back = back self.creationDate = creationDate } } On the other hand the following stand alone code (in it's own project) compiles without error. So I am confused and a little fed up with Apple publishing sample code that doesn't compile. import SwiftData @Model final class Card { var front: String var back: String var creationDate: Date init(front: String, back: String, creationDate: Date = .now) { self.front = front self.back = back self.creationDate = creationDate } } struct ContentView: View { var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .padding() } } #Preview { ContentView() }
1
0
639
Aug ’23
SwiftUI view update problem
I have encountered an issue with nested view updates that I don't understand. Maybe someone can explain what is happening. In the code below the ContentView loads 2 views in succession. MyView1 followed by MyView2. MyView displays a button while MyView2 displays the value of its first argument. When the button is pressed MyView1 changes the value of its bound first argument. The ContentView is reloaded because of the change to its first argument. This results in MyView1 and MyView2 both being loaded again. Looked at from a procedural point of view this isn't what I was expecting. import SwiftUI @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct ContentView: View { @State var mydata1:Int = 0 @State var mydata2:Int = 1 var body: some View { VStack { Text("Hello world \(mydata1)") MyView1(v1:$mydata1, v2:$mydata2) Text(" myData1 = \(mydata1) myData2 = \(mydata2) ") MyView2(v1:$mydata1, v2:$mydata2) Text("Bye bye \(mydata1)") } } } struct MyView1:View { @Binding var v1:Int @Binding var v2:Int var body: some View { Text("MyView1") if $v1.wrappedValue == 0 { Button(action: { $v1.wrappedValue = 10 }, label: { Text("OK") }) } } } struct MyView2:View { @Binding var v1:Int @Binding var v2:Int var body: some View { Text("MyView2") if $v1.wrappedValue == 0 { Text("v1 = \(v1) v2 = \(v2) ") } else { Text("???") } } }
2
0
785
Apr ’24
Defining Transformer for NSAttributedString
Coredata used to save attributed strings, but now requires a secure coding transformer. I have tried the code below, but it fails claiming This decoder will only decode classes that adopt NSSecureCoding. Class '__SwiftValue' does not adopt it The transformer has been registered and the attributes given the name 'AttributedStringToDataTransformer' Any suggestions as to what is wrong? Here's the code: class AttributedStringToDataTransformer: ValueTransformer {     override func transformedValue(_ value: Any?) - Any? {         let boxedData = try! NSKeyedArchiver.archivedData(withRootObject: value!, requiringSecureCoding: true)         return boxedData   }     override func reverseTransformedValue(_ value: Any?) - Any? {         let typedBlob = value as! Data         let data = try! NSKeyedUnarchiver.unarchivedObject(ofClasses: [NSAttributedString.self], from: typedBlob)         return (data as! NSAttributedString)     } } extension AttributedStringToDataTransformer {     /// The name of the transformer. This is the name used to register the transformer using `ValueTransformer.setValueTrandformer(_"forName:)`.     static let name = NSValueTransformerName(rawValue: String(describing: AttributedStringToDataTransformer.self))     /// Registers the value transformer with `ValueTransformer`.     public static func register() {        ValueTransformer.setValueTransformer(AttributedStringToDataTransformer(), forName: name)     } }
1
0
885
Mar ’21
Xcode 16 & Package load failure
I have installed Sequoia and Xcode 16 and now I can't add packages to my (or any project). I just get a message saying the package can't be resolved. Basically I can't carry on developing. SORT THIS OUT APPLE
Replies
22
Boosts
15
Views
11k
Activity
May ’25
Sonoma 14 & Xcode 14.3.1
I have just upgraded to Sonoma 14. When I launch Xcode 14.3.1 it says I need to update to the latest version and send me to the AppStore where the latest version is 14.3.1? I have beta Xcode 15 installed, but can upload apps compiled with it to the AppStore. What's going on?
Replies
5
Boosts
0
Views
8.8k
Activity
Oct ’23
Ventura & XCode
So I installed the latest OS update from Settings not realising that it wasn’t a Monteray update, but Ventura beta. But then when I tried running XCode I get a message that it won’t work with Ventura. So I’m stuck because I was about to release an App, but can’t because the App Store won’t accept stuff built with beta software. So thanks Apple. Of course it’s all my own fault for not reading the Release notes where it is buried in the detail.
Replies
0
Boosts
1
Views
789
Activity
Jun ’22
Project Navigator Collapsing all the time
The project navigator in my project keeps collapsing for no apparent reason. I've hunted high and low but can't find a setting to keep it expanded. This is not a new project and the issue began recently after an Xcode upgrade. I am currently using Xcode 15.3 release candidate. If anyone knows how to fix this I'd be very grateful if they could let me know.
Replies
6
Boosts
3
Views
2.2k
Activity
Sep ’24
IOS document icon not appearing
I can't get my app's document icon to appear for my document extension. I have tried different ways of configuring it based on Apple's documentation and various solutions posted on the internet. At first I tried adding the icon to the imported type identifier box where it says 'Add imported type identifier icons here' nothing happens when I select an icon (.png) stored in the project. I have checked the info.plist source and there is nothing there. I have since tried editing the source directly. Here are the relevant pieces of my latest attempt. Can anyone tell me where I'm going wrong. Thanks. <key>CFBundleDocumentTypes</key> <array>         <dict>             <key>CFBundleTypeIconFiles</key>             <string>writingshed.png</string>             <key>CFBundleTypeName</key>             <string>Writing Shed Data</string>             <key>LSHandlerRank</key>             <string>Owner</string>             <key>LSItemContentTypes</key>             <array>                 <string>wsd</string>             </array>         </dict> </array> <key>UTExportedTypeDeclarations</key> <array> <dict> <key>UTTypeDescription</key> <string>Writing Shed Data</string> <key>UTTypeIconFiles</key> <array> <string>writingshed.png</string> </array> <key>UTTypeIdentifier</key> <string>WritingShedData</string> <key>UTTypeTagSpecification</key> <dict> <key>public.filename-extension</key> <array> <string>wsd</string> </array> </dict>             <key>UTTypeConformsTo</key>             <array>                 <string>public.data</string>             </array> </dict> </array> <key>UTImportedTypeDeclarations</key> <array> <dict> <key>CFBundleTypeRole</key> <string>Editor</string> <key>UTTypeConformsTo</key> <array/> <key>UTTypeDescription</key> <string>Writing Shed Data</string> <key>UTTypeIconFiles</key> <array> <string>writingshed.png</string> </array> <key>UTTypeIdentifier</key> <string>WritingShedData</string> <key>UTTypeTagSpecification</key> <dict> <key>public.filename-extension</key> <array> <string>wsd</string> </array> </dict> </dict> </array>
Replies
1
Boosts
1
Views
1.4k
Activity
Oct ’21
Xcode 15 beta 8 link error
After installing beta 8 I'm suddenly getting the following: ld: warning: building for 'macCatalyst', but linking in dylib (/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa.tbd) built for 'macOS' Any help gratefully received.
Replies
1
Boosts
1
Views
972
Activity
Sep ’23
NSAttributed string issue
When I assign an NSMutableAttributedString to a NSAttributedString I am getting error [UICTFont textBlocks]: unrecognized selector sent to instance There must be something wrong with the string but I cannot find any documentation that might explain this. Does anyone know what the error means?
Replies
2
Boosts
0
Views
1.1k
Activity
Apr ’21
Dynamic type & custom font
If I call let font = UIFont.preferredFont(forTextStyle:.body) Then font.pointSize has value 17 If, however, I call this with a font such as Arial             let font = UIFont.fontWithNameAndTraits(fontName,                                                     size: styleAttributes.fontSize ?? 12,                                                     bold: styleAttributes.bold ?? false,                                                     italic: styleAttributes.italic ?? false)             let fontMetrics = UIFontMetrics(forTextStyle: .body)             let scaledFont = fontMetrics.scaledFont(for: font) Then scaledFont.pointSize has value 12. I was expecting 17, so I must be doing something wrong. Any suggestion? The function fontWithNameAndTraits is:     class func fontWithNameAndTraits(_ name:String, size:CGFloat, bold:Bool, italic:Bool)-UIFont {         let fontRef = UIFont.getFontRefForNameAndTraits(name, size:size, bold:bold, italic:italic)         let fontNameKey = CTFontCopyName(fontRef , kCTFontPostScriptNameKey)! as String         return UIFont(name: fontNameKey as String, size:CTFontGetSize(fontRef ))!     }
Replies
1
Boosts
0
Views
994
Activity
Apr ’21
App Preview Issue
I am trying to upload app previews for iPad having done so successfully for iPhone. No matter how hard I try the store rejects them claiming "Your app preview contains unsupported or corrupted Audio". I am using Mac OS Ventura. Has anyone else hit this issue?
Replies
2
Boosts
0
Views
1.4k
Activity
Jun ’22
Provisioning profile failed qualification
I'm suddenly getting this error when distributing an app that uploaded ok a couple of days ago. Nothing had changed. The associated message is: Profile doesn't include the selected signing certificate. I've checked the certificates and they are OK. I am using automatic signing. Any ideas?
Replies
6
Boosts
0
Views
1.8k
Activity
Oct ’22
Problem compiling @Model
I tried coding along with the WWDC23 'Dive Deeper into SwiftData' video but can't get the sample code to compile. For example the Card class fails with lots of errors associated with @Model. The first of these is: Type 'Card' does not conform to protocol 'PersistentModel' import SwiftUI import SwiftData @Model final class Card { var front: String var back: String var creationDate: Date init(front: String, back: String, creationDate: Date = .now) { self.front = front self.back = back self.creationDate = creationDate } } On the other hand the following stand alone code (in it's own project) compiles without error. So I am confused and a little fed up with Apple publishing sample code that doesn't compile. import SwiftData @Model final class Card { var front: String var back: String var creationDate: Date init(front: String, back: String, creationDate: Date = .now) { self.front = front self.back = back self.creationDate = creationDate } } struct ContentView: View { var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .padding() } } #Preview { ContentView() }
Replies
1
Boosts
0
Views
639
Activity
Aug ’23
SwiftUI view update problem
I have encountered an issue with nested view updates that I don't understand. Maybe someone can explain what is happening. In the code below the ContentView loads 2 views in succession. MyView1 followed by MyView2. MyView displays a button while MyView2 displays the value of its first argument. When the button is pressed MyView1 changes the value of its bound first argument. The ContentView is reloaded because of the change to its first argument. This results in MyView1 and MyView2 both being loaded again. Looked at from a procedural point of view this isn't what I was expecting. import SwiftUI @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct ContentView: View { @State var mydata1:Int = 0 @State var mydata2:Int = 1 var body: some View { VStack { Text("Hello world \(mydata1)") MyView1(v1:$mydata1, v2:$mydata2) Text(" myData1 = \(mydata1) myData2 = \(mydata2) ") MyView2(v1:$mydata1, v2:$mydata2) Text("Bye bye \(mydata1)") } } } struct MyView1:View { @Binding var v1:Int @Binding var v2:Int var body: some View { Text("MyView1") if $v1.wrappedValue == 0 { Button(action: { $v1.wrappedValue = 10 }, label: { Text("OK") }) } } } struct MyView2:View { @Binding var v1:Int @Binding var v2:Int var body: some View { Text("MyView2") if $v1.wrappedValue == 0 { Text("v1 = \(v1) v2 = \(v2) ") } else { Text("???") } } }
Replies
2
Boosts
0
Views
785
Activity
Apr ’24
WWDC23 flashcard app
Where can I download the code for this app? I know its listed on the video page, but I would like a link to somewhere to download it
Replies
1
Boosts
0
Views
573
Activity
May ’24
Preview crash
I'm getting a fatal error in a preview: fatalError in Environment+Objects.swift at line 34. Anyone any idea how to find this file
Replies
2
Boosts
0
Views
374
Activity
Feb ’25
Defining Transformer for NSAttributedString
Coredata used to save attributed strings, but now requires a secure coding transformer. I have tried the code below, but it fails claiming This decoder will only decode classes that adopt NSSecureCoding. Class '__SwiftValue' does not adopt it The transformer has been registered and the attributes given the name 'AttributedStringToDataTransformer' Any suggestions as to what is wrong? Here's the code: class AttributedStringToDataTransformer: ValueTransformer {     override func transformedValue(_ value: Any?) - Any? {         let boxedData = try! NSKeyedArchiver.archivedData(withRootObject: value!, requiringSecureCoding: true)         return boxedData   }     override func reverseTransformedValue(_ value: Any?) - Any? {         let typedBlob = value as! Data         let data = try! NSKeyedUnarchiver.unarchivedObject(ofClasses: [NSAttributedString.self], from: typedBlob)         return (data as! NSAttributedString)     } } extension AttributedStringToDataTransformer {     /// The name of the transformer. This is the name used to register the transformer using `ValueTransformer.setValueTrandformer(_"forName:)`.     static let name = NSValueTransformerName(rawValue: String(describing: AttributedStringToDataTransformer.self))     /// Registers the value transformer with `ValueTransformer`.     public static func register() {        ValueTransformer.setValueTransformer(AttributedStringToDataTransformer(), forName: name)     } }
Replies
1
Boosts
0
Views
885
Activity
Mar ’21