Posts

Post not yet marked as solved
11 Replies
37k Views
My app is working as expected in the simulator on iOS 12.1, but not on my iOS 11.x device, and it is just a layout issue. I'm not aware of any major changes in layout constraints from 11 to 12, so I'm perplexed... I upgraded an older device from iOS 10 to 12 and my app layout works on it, so it seems something changed between iOS 11 and 12 regarding layout, but I don't know what that is...How can I get a simulator running iOS 11.x to debug? I'll start debugging on my actual 11.x device, but I would also like to know how to get a simulator running older iOS versions? xcodebuild -showsdks says I only have 12.1 iphone/simulator 12.1 -- how do I run 11.x in the simulator, or older iOS versions in general in the simulator?
Posted
by remsleep.
Last updated
.
Post not yet marked as solved
1 Replies
1.1k Views
I have a multiplatform project in Xcode 13.3.1, but when I try to run a unit by clicking the diamond in the gutter, the linker fails. From the link line in the log, it looks as if it isn't even linking with my app at all. I also noticed that I had to put in my own @testable import NameOfMyApp instead of Xcode generating that line like it does for single-platform projects, so that makes me wonder if this something extra i need to do since this project is multiplatform? Everything compiles fine, but the linker seems to be forgeting to link with my app...
Posted
by remsleep.
Last updated
.
Post marked as solved
2 Replies
3.3k Views
I've upgraded to 10.2 and now when I try to commit, Xcode says "No author information was supplied by the version control system". There is an option to "Fix", which takes me to preferences, where I added my name -- but still no success.How do I get git to work again on 10.2?
Posted
by remsleep.
Last updated
.
Post not yet marked as solved
1 Replies
325 Views
When an Array has an Element type that is an optional, I'd like to count the non-nil elems. Is there a way to do this with just a var? How can I say that Element is an Optional<T>, without introducing T via the generic func? Thanx. extension Array {     func someCount<T>() -> Int where Element == Optional<T> {         self.reduce(0) { count, elem in count + (elem == nil ? 0 : 1)     } }
Posted
by remsleep.
Last updated
.
Post not yet marked as solved
1 Replies
556 Views
My App had no such warnings before updating to 13.3, but now it claims I'm updating from a background thread. A simple print will make these warnings stop, so something is wrong:  @MainActor private func runOnMain(_ action: @escaping () async -> ()) async {         //print("", terminator: "")         await action()     } simply uncommenting that print() makes all the warnings go away, so I think 13.3 has an issue here... Is anyone else seeing this?
Posted
by remsleep.
Last updated
.
Post not yet marked as solved
4 Replies
497 Views
If i have a struct inside a function, swift keeps telling me is doesn't conform to Comparable, even though the same definition is fine outside of a function -- why is this? Foo fails Comparable here: func foo() {             struct Foo : Equatable, Comparable {                 let x: Int                 let y: Int                 static func (lhs: Foo, rhs: Foo) - Bool {                     return lhs.x+lhs.y rhs.x+rhs.y                 }             }         }
Posted
by remsleep.
Last updated
.
Post not yet marked as solved
2 Replies
912 Views
In my AppDelegate, I'm picking a seed like this on my physical iPad Pro:func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -&gt; Bool { // Override point for customization after application launch. sysRandom = GKRandomSource.sharedRandom() randDist0 = GKRandomDistribution(randomSource: sysRandom!, lowestValue: 0, highestValue: 0xffffffff) let _ = randDist0!.nextInt() let toss = randDist0!.nextInt() print("App Seed: \(toss)") appSeed0 = tossI keep getting a seed of 0, so I'm clearly not understanding something. The shared random source on my iPad should be giving me a random value, right? I was tossing twice just to be sure... What am I doing wrong here?
Posted
by remsleep.
Last updated
.
Post marked as solved
4 Replies
6.9k Views
I was surprised (Int,Int) isn't Hashable. How do I write the obvious extension to make it so?If I try "extension (Int,Int)" the error is that non-nominal type (Int,Int) can't be extended. The word "nominal" appears nowhere in the Swift iBooks provided by Apple, so I can't be absolutely certain that I even know what Xcode is telling here... Using a typealias gives the same error.How do I extend (Int,Int) to make it Hashable so I can use it for dictionary keys? What is a "non-nominal" type, and where can I find that definition?
Posted
by remsleep.
Last updated
.