Post

Replies

Boosts

Views

Activity

Reply to What is "bridgeOS Device Support" for?
12 months later and once again I'm wondering if I can delete 7.5 GB of "bridgeOS" device support files. Apparently, currently I have: bridgeOS 12.5.5 (16H62) bridgeOS 12.5.6 (16H71) bridgeOS iPhone7,1 12.5.7 (16H81) bridgeOS iPhone11,6 16.3.1 (20D67) Now iPhone7,1 is apparently my iPhone 6 Plus, which I'm no longer using for development, so I guess I can remove that. It is running iOS 12.5.7, so maybe these bridgeOS versions numbers correspond to iOS version numbers? If that's true I can remove all of the 12.x versions. iPhone11,6 is my iPhone XS, which I do still test on - but it's now running iOS 18, so maybe I can get rid of the bridgeOS version 16? Ha, but that one is "zero kb". If anyone knows anything.... wait till I've deleted too much and then let me know what I should have kept, right :-)
Dec ’24
Reply to App Directories And Data
Documents or an Application Support directory in the Library. From everything I’ve read, it seems that Apple’s intent is Library/Application Support. Which is the correct location? Application Support - though it doesn’t really matter except in the case where you have a mixture of “documents” that the user needs to have access to via e.g. the Files app and “non-documents” that they shouldn’t. the app stopped displaying what was two years of data in SQLite. I haven’t yet tested for index corruption, however one of the programmers believes this resulted from an iOS update that needed space and cleared data in the cache (but that makes no sense to myself). You weren’t storing it in the Caches directory, or using the “don’t backup” xattr, were you? OS updates can “offload” apps, but I’ve not seen any reports of that causing problems. Do you vacuum your sqlite db?
Topic: App & System Services SubTopic: General Tags:
Dec ’24
Reply to ADEP Termination
What is the current state of jailbreaking? If you’re lucky, you’ll be able to crack your devices and continue to run your custom apps. With more than 1000 of them, it is probably worthwhile to employ a “security researcher” to help you with this. If that doesn’t work, sell the devices on eBay and replace them with Android - you may even make a profit doing that, though your software redevelopment costs could wipe that out. It sounds like your business might be large enough to afford a reasonable lawyer, unlike most of those who get terminated without a reason. But of course Apple can afford a better one, so there still isn’t much hope.
Dec ’24
Reply to SwiftUI Entry Point - Proper Location In Project
How/where do I declare global variables in the same file as "main" location? Variables declared outside of any class, struct or function, i.e. at the zero-indentation level, are ”global”. But what, exactly, do you mean by “main”? The Swift equivalent of the “main function” in the C sense is partly explain by eoonline above, but I don’t think that’s really what you mean. I think you mean something more like “constructor”, or similar. On a large project, there will be multiple associated files that contain related functions. How do make calls to these functions from the "main" file? Do you understand concepts like classes, objects and methods? In C# for example, I can't simply call the function name, it has to be associated the "class" that the function is stored in first. OK, so you have heard of classes… Do I have to declare these related functions in the "main" form ahead of usage? Generally, the Swift compiler finds declarations in other files without any extra work on your part (unlike C). But looking at your example, I think what you may be doing is creating instances of classes in order to call their methods. In that case, the answer is “yes, of course you need to create objects before you can call their (non-static) methods”. Eoonline wrote: Judging from your question, the problem might be less about the Swift language, itself (which I wager that you will quickly grok) than the SwiftUI framework I agree that you should absolutely learn non-UI Swift first, and then learn SwiftUI, taking care to understand that its body declarative parts are subtly different from other Swift code. I used "print(hi)" just to ensure that my function call was being called. Crucially, the calls 1 and 2 are not within a function, they’re within a SwiftUI body declaration. I’m not sure I agree with eoonline that you will “quickly grok” Swift, though. I have the impression that your first language was probably something without classes - maybe Fortran or Pascal - and you continue to think of everything in terms of those semantics.
Dec ’24
Reply to Identifying UIKit Api's failure
suppose If there is a case where it fails due to insufficient memory. To address that point specifically: (On iOS), When memory is low, apps get memory warnings and should free resources. If that’s not enough, suspended apps will be terminated. The only situation where you will really run out of memory is if you ask for a ridiculously large allocation, and that indicates a bug in your program. (The same is also true on other platforms, except embedded systems without virtual memory. Unless you run out of virtual address space, memory allocations will always succeed even when physical RAM is exhausted; the problem is dealt with by other mechanisms, such as Linux’s “OOM Killer”. Personally, in my C++ code I assume that memory allocation cannot fail.) More generally: if the API has some way of reporting an error, try to handle it; if it doesn’t, assume that it cannot fail for valid parameters.
Topic: UI Frameworks SubTopic: UIKit Tags:
Dec ’24
Reply to SwiftUI Entry Point - Proper Location In Project
I can’t really answer your questions, because the don’t make much sense. It sounds to me as if you have tried to learn Swift and SwiftUI by reading random bits of code and trying to work out what they mean by looking for connections with other languages. Sorry, that’s not going to work. Now in the SwiftUI project, I tried this... What do you actually want to happen? Presumably you want it to print “hi” at some point. When do you want it to do that? If you want it to print “hi” when a ContentView struct is created, put it in an init method.
Dec ’24
Reply to SimpleWatchConnectivity sample - modernizing it
I think you'd need to schedule a snapshot refresh if the WatchConnectivity background task updates your UI Or maybe not, according to the docs at https://developer.apple.com/documentation/watchkit/preparing-to-take-your-watchos-app-s-snapshot If your app uses the SwiftUI BackgroundTask tasks, the system automatically detects any changes to the user interface and schedules the snapshot task.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’24
Reply to SimpleWatchConnectivity sample - modernizing it
Many thanks! Here is the skeleton of what I have; any comments? In particular, should I be doing anything in the .backgroundTask(.watchConnectivity)? import Foundation; import SwiftUI; import WatchConnectivity; @Observable class Stats { var data: [String: Any] = [:]; }; struct StatsView: View { @Environment(Stats.self) private var stats; var body: some View { VStack { Text(stats.data.description) } } }; class SessionDelegate: NSObject, WCSessionDelegate { private var stats: Stats; init(stats: Stats) { self.stats = stats; } func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: (any Error)?) { // TODO check state, error, etc. stats.data = session.receivedApplicationContext; } func session(_ session: WCSession, didReceiveApplicationContext application_context: [String: Any]) { stats.data = session.receivedApplicationContext; } }; @main struct MyWatchApp: App { private var stats: Stats = Stats(); private var session_delegate: SessionDelegate; init() { assert(WCSession.isSupported(), "WCSession is not supported, hmm, when does this happen?"); session_delegate = SessionDelegate(stats: stats); WCSession.default.delegate = session_delegate; WCSession.default.activate(); } var body: some Scene { WindowGroup { StatsView() .environment(stats) } .backgroundTask(.watchConnectivity) { } } };
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’24
Reply to Overall Code Structure Of Swift Project
I’m going to mention the Swift Package Manager: https://www.swift.org/documentation/package-manager/ https://www.swift.org/getting-started/cli-swiftpm/ If you’re looking for something that’s closer to cargo run or make; make install than the full Xcode experience, this may be worth looking at. Question for the experts: to what extent is the Swift Package Manager “compatible” with Xcode? I.e. can I have a single source tree that’s usable by both? P.S. I’d be interested to hear your thoughts about C# vs. Rust vs. Swift generally.
Dec ’24
Reply to Causes of disordered dictionary in Swift
At each new for loop we get a random order of element That surprises me. Please post more code. In particular, are you calling test() on the same object each time, or are you creating a new Test object? The source for the swift dictionary is here: https://github.com/swiftlang/swift/blob/main/stdlib/public/core/Dictionary.swift It start with a lot of comments which you might like to read. In particular, at line 331: The order of key-value pairs in a dictionary is stable between mutations but is otherwise unpredictable. There are data structures that can change order between uses - for example, splay trees reorganise themselves so that recently- or frequently-used elements will be found more quickly. I don’t believe that the Swift dictionary is such a data strucutre.
Topic: Programming Languages SubTopic: Swift Tags:
Dec ’24
Reply to What is "bridgeOS Device Support" for?
12 months later and once again I'm wondering if I can delete 7.5 GB of "bridgeOS" device support files. Apparently, currently I have: bridgeOS 12.5.5 (16H62) bridgeOS 12.5.6 (16H71) bridgeOS iPhone7,1 12.5.7 (16H81) bridgeOS iPhone11,6 16.3.1 (20D67) Now iPhone7,1 is apparently my iPhone 6 Plus, which I'm no longer using for development, so I guess I can remove that. It is running iOS 12.5.7, so maybe these bridgeOS versions numbers correspond to iOS version numbers? If that's true I can remove all of the 12.x versions. iPhone11,6 is my iPhone XS, which I do still test on - but it's now running iOS 18, so maybe I can get rid of the bridgeOS version 16? Ha, but that one is "zero kb". If anyone knows anything.... wait till I've deleted too much and then let me know what I should have kept, right :-)
Replies
Boosts
Views
Activity
Dec ’24
Reply to App Directories And Data
Documents or an Application Support directory in the Library. From everything I’ve read, it seems that Apple’s intent is Library/Application Support. Which is the correct location? Application Support - though it doesn’t really matter except in the case where you have a mixture of “documents” that the user needs to have access to via e.g. the Files app and “non-documents” that they shouldn’t. the app stopped displaying what was two years of data in SQLite. I haven’t yet tested for index corruption, however one of the programmers believes this resulted from an iOS update that needed space and cleared data in the cache (but that makes no sense to myself). You weren’t storing it in the Caches directory, or using the “don’t backup” xattr, were you? OS updates can “offload” apps, but I’ve not seen any reports of that causing problems. Do you vacuum your sqlite db?
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Dec ’24
Reply to ADEP Termination
What is the current state of jailbreaking? If you’re lucky, you’ll be able to crack your devices and continue to run your custom apps. With more than 1000 of them, it is probably worthwhile to employ a “security researcher” to help you with this. If that doesn’t work, sell the devices on eBay and replace them with Android - you may even make a profit doing that, though your software redevelopment costs could wipe that out. It sounds like your business might be large enough to afford a reasonable lawyer, unlike most of those who get terminated without a reason. But of course Apple can afford a better one, so there still isn’t much hope.
Replies
Boosts
Views
Activity
Dec ’24
Reply to SwiftUI Entry Point - Proper Location In Project
How/where do I declare global variables in the same file as "main" location? Variables declared outside of any class, struct or function, i.e. at the zero-indentation level, are ”global”. But what, exactly, do you mean by “main”? The Swift equivalent of the “main function” in the C sense is partly explain by eoonline above, but I don’t think that’s really what you mean. I think you mean something more like “constructor”, or similar. On a large project, there will be multiple associated files that contain related functions. How do make calls to these functions from the "main" file? Do you understand concepts like classes, objects and methods? In C# for example, I can't simply call the function name, it has to be associated the "class" that the function is stored in first. OK, so you have heard of classes… Do I have to declare these related functions in the "main" form ahead of usage? Generally, the Swift compiler finds declarations in other files without any extra work on your part (unlike C). But looking at your example, I think what you may be doing is creating instances of classes in order to call their methods. In that case, the answer is “yes, of course you need to create objects before you can call their (non-static) methods”. Eoonline wrote: Judging from your question, the problem might be less about the Swift language, itself (which I wager that you will quickly grok) than the SwiftUI framework I agree that you should absolutely learn non-UI Swift first, and then learn SwiftUI, taking care to understand that its body declarative parts are subtly different from other Swift code. I used "print(hi)" just to ensure that my function call was being called. Crucially, the calls 1 and 2 are not within a function, they’re within a SwiftUI body declaration. I’m not sure I agree with eoonline that you will “quickly grok” Swift, though. I have the impression that your first language was probably something without classes - maybe Fortran or Pascal - and you continue to think of everything in terms of those semantics.
Replies
Boosts
Views
Activity
Dec ’24
Reply to Identifying UIKit Api's failure
suppose If there is a case where it fails due to insufficient memory. To address that point specifically: (On iOS), When memory is low, apps get memory warnings and should free resources. If that’s not enough, suspended apps will be terminated. The only situation where you will really run out of memory is if you ask for a ridiculously large allocation, and that indicates a bug in your program. (The same is also true on other platforms, except embedded systems without virtual memory. Unless you run out of virtual address space, memory allocations will always succeed even when physical RAM is exhausted; the problem is dealt with by other mechanisms, such as Linux’s “OOM Killer”. Personally, in my C++ code I assume that memory allocation cannot fail.) More generally: if the API has some way of reporting an error, try to handle it; if it doesn’t, assume that it cannot fail for valid parameters.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Dec ’24
Reply to SwiftUI Entry Point - Proper Location In Project
I can’t really answer your questions, because the don’t make much sense. It sounds to me as if you have tried to learn Swift and SwiftUI by reading random bits of code and trying to work out what they mean by looking for connections with other languages. Sorry, that’s not going to work. Now in the SwiftUI project, I tried this... What do you actually want to happen? Presumably you want it to print “hi” at some point. When do you want it to do that? If you want it to print “hi” when a ContentView struct is created, put it in an init method.
Replies
Boosts
Views
Activity
Dec ’24
Reply to SimpleWatchConnectivity sample - modernizing it
I think you'd need to schedule a snapshot refresh if the WatchConnectivity background task updates your UI Or maybe not, according to the docs at https://developer.apple.com/documentation/watchkit/preparing-to-take-your-watchos-app-s-snapshot If your app uses the SwiftUI BackgroundTask tasks, the system automatically detects any changes to the user interface and schedules the snapshot task.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’24
Reply to SimpleWatchConnectivity sample - modernizing it
Many thanks! Here is the skeleton of what I have; any comments? In particular, should I be doing anything in the .backgroundTask(.watchConnectivity)? import Foundation; import SwiftUI; import WatchConnectivity; @Observable class Stats { var data: [String: Any] = [:]; }; struct StatsView: View { @Environment(Stats.self) private var stats; var body: some View { VStack { Text(stats.data.description) } } }; class SessionDelegate: NSObject, WCSessionDelegate { private var stats: Stats; init(stats: Stats) { self.stats = stats; } func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: (any Error)?) { // TODO check state, error, etc. stats.data = session.receivedApplicationContext; } func session(_ session: WCSession, didReceiveApplicationContext application_context: [String: Any]) { stats.data = session.receivedApplicationContext; } }; @main struct MyWatchApp: App { private var stats: Stats = Stats(); private var session_delegate: SessionDelegate; init() { assert(WCSession.isSupported(), "WCSession is not supported, hmm, when does this happen?"); session_delegate = SessionDelegate(stats: stats); WCSession.default.delegate = session_delegate; WCSession.default.activate(); } var body: some Scene { WindowGroup { StatsView() .environment(stats) } .backgroundTask(.watchConnectivity) { } } };
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’24
Reply to Overall Code Structure Of Swift Project
I’m going to mention the Swift Package Manager: https://www.swift.org/documentation/package-manager/ https://www.swift.org/getting-started/cli-swiftpm/ If you’re looking for something that’s closer to cargo run or make; make install than the full Xcode experience, this may be worth looking at. Question for the experts: to what extent is the Swift Package Manager “compatible” with Xcode? I.e. can I have a single source tree that’s usable by both? P.S. I’d be interested to hear your thoughts about C# vs. Rust vs. Swift generally.
Replies
Boosts
Views
Activity
Dec ’24
Reply to Causes of disordered dictionary in Swift
At each new for loop we get a random order of element That surprises me. Please post more code. In particular, are you calling test() on the same object each time, or are you creating a new Test object? The source for the swift dictionary is here: https://github.com/swiftlang/swift/blob/main/stdlib/public/core/Dictionary.swift It start with a lot of comments which you might like to read. In particular, at line 331: The order of key-value pairs in a dictionary is stable between mutations but is otherwise unpredictable. There are data structures that can change order between uses - for example, splay trees reorganise themselves so that recently- or frequently-used elements will be found more quickly. I don’t believe that the Swift dictionary is such a data strucutre.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Dec ’24