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.7k
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
770
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.1k
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
945
Sep ’23
Error initialising UnsafeMutablePointer<ObjCBool>
The following code compiles ok in one function:         let stop:UnsafeMutablePointerObjCBool stop.initialize(to: false) text.enumerateAttribute(kStyleKey,                                 in: NSRange(location: 0, length: text.string.count),                                 options: []) { (value, range, stop) in but the following code which is virtually the same fails the initialise with the error "Constant 'stop' being used before being initialised" :         let stop:UnsafeMutablePointerObjCBool stop.initialize(to: false) attributedText.enumerateAttribute(kStyleKey,                                           in: NSRange(location: selectedRange.location, length: selectedRange.length),                                 options: []) { (value, range, stop) in Any suggestions - looks like a compiler issue to me.
10
0
2.2k
Mar ’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 ))!     }
1
0
987
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
614
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
739
Apr ’24