Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I agree with your coworker, even if it looks like it works now I wouldn't assume it holds up. Unfortunately I don't know of another way.

I'm not sure what exactly is preventing you from adding the UIHostingController as a child. Could you change your method to return a UIViewController and wrap other returned views in one? Or return an enum with distinct view and view controller cases?

Adbot
ADBOT LOVES YOU

101
Oct 15, 2012


Vault Dweller

pokeyman posted:

Congrats!

Also lol

Cheers. I'm stuck between lolling and nerves myself.

former glory posted:

I'm such a declarative UI convert after learning SwiftUI that this sounds like a nice scenario, congrats and good luck with the change. In my experience so far, once you get the UI to do what you need in 100% swift, it's rock solid and has far fewer unexpected cases. But it can be a bit of a fight at first.

Thanks.

I'm hoping I'm the same, since it's clearly the way iOS development is going. The app is built using a Redux/TCA type system, which I really like using when I've tooled around with it. It seems like the system that makes the most sense to my brain with declarative stuff.

It's also (embarrassingly) the first company I'll have worked for that cares about test coverage, and it actually looks like they'll actually be enjoyable to write with this approach. Always happy to have more tools in my belt.

dizzywhip
Dec 23, 2005

uncle blog posted:

My coworker thinks this implementation is bad since view lifecycle management is handled differently in both UIKit and SwiftUI, and without adding the hosting VC to the parent VC (which I have no access to at this location), we might end up experiencing weird layout or performance issues. So I wonder if there's a better way to pass a SwiftUI view as a UIView (without having access to the VC)?

It's not really a good idea to pluck a view from a view controller and then throw away the controller. If everything seems to work fine, maybe you can get away with it, but there's a reasonable chance that it'll break in the future as implementation details change in the OS or when you happen to change something in the SwiftUI view that depends on the underlying view controller hierarchy.

There must be a reason that UIKit only gets a hosting controller and not a hosting view like we get with AppKit because it's an annoying limitation that makes it harder to incrementally migrate to SwiftUI, so I can't imagine Apple would leave it out without a good reason. In any case, if you want to avoid future bugs, I would recommend embedding the hosting controller into the hierarchy.

uncle blog
Nov 18, 2012

Thanks for the clarifications/tips. Ended up redoing the view in UIKit. Was a small and easy view, but I was a bit excited to contribute my first piece of SwiftUI.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

uncle blog posted:

Thanks for the clarifications/tips. Ended up redoing the view in UIKit. Was a small and easy view, but I was a bit excited to contribute my first piece of SwiftUI.

There is some new api in iOS 16 (I think) that makes it easy to vend SwiftUI views as collection/table view cells, which is way nicer than trying to wedge a view controller in every cell. So maybe you'll have more opportunities soon!

KidDynamite
Feb 11, 2005

if i have a UICollectionView using UICollectionViewCompositionalLayout is it possible to place a header vertically above some horizontally scrolling cells?

i want
code:
  [Header]
  [Cell]<->[Cell]<->[Cell]
what i currently get when i add the header to NSCollectionLayoutSection.boundarySupplementaryItems
code:
[Header]<->[Cell]<->[Cell]<->[Cell]

KidDynamite
Feb 11, 2005

figured this out right after hitting post by setting UICollectionViewCompositionalLayoutConfiguration.scrollDirection to vertical and NSCollectionLayoutSection.orthogonalScrollingBehavior to continuous

spacing is wacky so if anyone has experience there I'd appreciate it. if not back to digging tomorrow.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
If you get really stuck, could put the header in its own section?

Small White Dragon
Nov 23, 2007

No relation.
I need some GPU features that don't work on A8 (or earlier) chips. Not that I expect there are a ton of these still floating around in active use, but is there a way to specify that in Info.plist rather than just "Hey, this won't work if you have these models" in the App Store description?

101
Oct 15, 2012


Vault Dweller

Small White Dragon posted:

I need some GPU features that don't work on A8 (or earlier) chips. Not that I expect there are a ton of these still floating around in active use, but is there a way to specify that in Info.plist rather than just "Hey, this won't work if you have these models" in the App Store description?

A look at the Wikipedia page seems to suggest no devices on iOS 16 run A8s, so you could specify a minimum that way?

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Small White Dragon posted:

I need some GPU features that don't work on A8 (or earlier) chips. Not that I expect there are a ton of these still floating around in active use, but is there a way to specify that in Info.plist rather than just "Hey, this won't work if you have these models" in the App Store description?

All the device feature options are here:

https://developer.apple.com/library...lityMatrix.html

It looks like arkit would approximate what you want...

Small White Dragon
Nov 23, 2007

No relation.

101 posted:

A look at the Wikipedia page seems to suggest no devices on iOS 16 run A8s, so you could specify a minimum that way?

Hm, I have an A8 AppleTV which runs tvOS 16

go play outside Skyler
Nov 7, 2005


Maybe stating the obvious here but I think the best way to handle that situation would be to implement a CPU fallback.

Small White Dragon
Nov 23, 2007

No relation.

go play outside Skyler posted:

Maybe stating the obvious here but I think the best way to handle that situation would be to implement a CPU fallback.

I appreciate the suggestion --- it's a nice idea; we had briefly looked into it but it seems like it'd be a huge investment for... probably very little return.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer
I don't know if I was clear earlier lol but does this work for you?

code:
<key>UIRequiredDeviceCapabilities</key>
<array>
    <string>arkit</string>
</array>
I'm not sure if this is compatible with AppleTV/they're not in that device matrix but that keys seems to exclude anything less than an A9.

101
Oct 15, 2012


Vault Dweller
I somehow missed that Strings support Markdown now, and I'm in love

SaTaMaS
Apr 18, 2003
Has anyone else started seeing incredibly long load times in UIKit based apps post iOS 16/XCode 14? All of a sudden our app is taking ~60 seconds to load if it doesn't just crash first. The error message we're getting is "UINavigationBar decoded as unlocked for UINavigationController, or navigationBar delegate set up incorrectly. Inconsistent configuration may cause problems."
There's an Apple thread for the error message with no reliable solutions: https://developer.apple.com/forums/thread/714278

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I've seen that console message but didn't associate it with prolonged launch times. I'll try to keep an eye out!

uncle blog
Nov 18, 2012

Are there any well-known examples of iOS apps that to a large extent use a lot of webviews? Both successful or unsuccessful examples are most welcome!

KidDynamite
Feb 11, 2005

uncle blog posted:

Are there any well-known examples of iOS apps that to a large extent use a lot of webviews? Both successful or unsuccessful examples are most welcome!

old netflix app was all webview. i can't think of any others.

take boat
Jul 8, 2006
boat: TAKEN
I worked on a few moderately popular apps that used webviews for many non-core flows (for example, email notification settings, limited-time promotions, features or services provided by a third party) where it wasn't considered worth the effort to build and maintain iOS and Android native experiences. the average user wouldn't see many, but in total there were a substantial number

Glimm
Jul 27, 2005

Time is only gonna pass you by

Is there an easy way to tell if an xcframework relies on/uses HealthKit?

We rely on a 3rd party to give us a binary SDK. They have a version that uses HealthKit and one that does not. They say they've provided us the version without HealthKit, but Apple is rejecting our application because we use HealthKit or CareKit, according to their analysis.

I'm sure we (or the folks providing that SDK) are doing something that's causing HealthKit to be referenced, but I'm not sure how to test for it or validate the build beyond sending it to Apple and crossing my fingers.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
otool -L Foo.framework/Foo will list the libraries that a framework depends on.

Glimm
Jul 27, 2005

Time is only gonna pass you by

Plorkyeran posted:

otool -L Foo.framework/Foo will list the libraries that a framework depends on.

Thanks!

Fate Accomplice
Nov 30, 2006




https://developer.apple.com/documentation/swift/set

Why do Swift Sets have a first but not a last?

Neither or both make more sense

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I don't have an answer, though I suspect part of the puzzle is conformance to Collection.

go play outside Skyler
Nov 7, 2005


If anyone is wondering why their apps are now crashing on iOS 16.1, it's because they changed the behavior of how memory is freed. Now it zeroes out everything.

This means that bad uses of withUnsafe or the ampersand which used to go undetected, can now cause weird crashes.

Just thought it might save someone some time.

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

I'm an idiot novice with Swift development and my little side project has already run into yak shaving hell. I'm writing a small command-line utility in Swift with Xcode and I want to use the ArgumentParser package. Is it possible to get Xcode to statically link a Swift package into a command-line tool project? The way it sets everything up is dynamic linking but that means if I want to run the tool outside Xcode it won't work without me putting the framework in one of the system locations. I'm not planning on distributing this anywhere but I wanted to at least build a single executable so I could send it around if I wanted.

Is there a way to do this or should I just do what it wants and move the framework into a search location? In Java I'd just shade the library into the jar...

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

carry on then posted:

I'm an idiot novice with Swift development and my little side project has already run into yak shaving hell. I'm writing a small command-line utility in Swift with Xcode and I want to use the ArgumentParser package. Is it possible to get Xcode to statically link a Swift package into a command-line tool project? The way it sets everything up is dynamic linking but that means if I want to run the tool outside Xcode it won't work without me putting the framework in one of the system locations. I'm not planning on distributing this anywhere but I wanted to at least build a single executable so I could send it around if I wanted.

Is there a way to do this or should I just do what it wants and move the framework into a search location? In Java I'd just shade the library into the jar...

I don't know a direct way. I wonder if you could define a static library target that depends on ArgumentParser, then have your executable depend on that intermediary library? May need to stick an
Swift code:
@_exported import ArgumentParser
in a .swift in the library so you can actually use ArgumentParser from your executable.

vote_no
Nov 22, 2005

The rush is on.

carry on then posted:

I'm an idiot novice with Swift development and my little side project has already run into yak shaving hell. I'm writing a small command-line utility in Swift with Xcode and I want to use the ArgumentParser package. Is it possible to get Xcode to statically link a Swift package into a command-line tool project? The way it sets everything up is dynamic linking but that means if I want to run the tool outside Xcode it won't work without me putting the framework in one of the system locations. I'm not planning on distributing this anywhere but I wanted to at least build a single executable so I could send it around if I wanted.

Is there a way to do this or should I just do what it wants and move the framework into a search location? In Java I'd just shade the library into the jar...

I read this thread to learn about Swift so I don’t know about static linking there, but you could avoid the need for putting the libraries in the system by having a wrapper script for it that sets the library path and executes the application. Package the 3 together in a folder and I assume it would be relatively portable. Then again, C++ dev here so ¯\_(ツ)_/¯

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

I wound up restarting, using swiftpm instead of Xcode to create the project and specify the dependencies in the Package.swift file, and that builds everything into the executable by default (or at least seems to, haven't tried running it on a system other than the one I built it on). I wonder why Xcode is completely capable of using Package.swift but instead stores everything in the xcodeproj if you use it to create the project, but I use Eclipse in my day job so I know better than to be surprised when an IDE sucks rear end.

Thanks for your answers though.

carry on then fucked around with this message at 00:26 on Dec 4, 2022

KidDynamite
Feb 11, 2005

where do you get dsyms now? they're not on appstoreconnect and the archiver's download dsym button errors out(because i'm assuming it's trying to download from appstoreconnect.)

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer
You should just be generating them yourself when you make a build. The bitcode generation thing is phased out now, so downloading dsyms after the fact isn't necessary b/c Apple isn't dynamically recompiling your builds anymore.

Small White Dragon
Nov 23, 2007

No relation.
Apple never implemented a way to charge for major upgrades to iOS apps, did they?

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Nope, you still have to just release an entirely new app.

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
or put any new “pro” features behind an in-app purchase

Cup Runneth Over
Aug 8, 2009

She said life's
Too short to worry
Life's too long to wait
It's too short
Not to love everybody
Life's too long to hate


If I want an upcycled Mac to compile for OSX on do I just buy the cheapest one I can find or is there a cutoff year for being able to compile something modern Macs can run? I won't be programming on it, just need Apple silicon for compilation.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Cup Runneth Over posted:

If I want an upcycled Mac to compile for OSX on do I just buy the cheapest one I can find or is there a cutoff year for being able to compile something modern Macs can run? I won't be programming on it, just need Apple silicon for compilation.

Any Apple Silicon Mac will work, the oldest is only a couple years old.

duck monster
Dec 15, 2004

Those mac minis are at a pretty good sweet spot between cheap (Well, apple cheap) , modern and performant

Adbot
ADBOT LOVES YOU

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

Cup Runneth Over posted:

If I want an upcycled Mac to compile for OSX on do I just buy the cheapest one I can find or is there a cutoff year for being able to compile something modern Macs can run? I won't be programming on it, just need Apple silicon for compilation.

You’ll also be testing and debugging and profiling on it though, won’t you?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply