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.

KidDynamite posted:

What makes you say that?

They started shipping in Xcode 13.3 beta 1 I think.

Adbot
ADBOT LOVES YOU

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Pulcinella posted:

Is there an easy way to determine the the origin of a CALayer is top left (e.g. UIKit) or bottom left (e.g. AppKit)? I’m doing some custom CAShapeLayers and custom corner clipping and I just realized that For a CACornerMask, .minXMinY is top left on iOS and bottom left on macOS (unless it’s a catalyst app). I’d like to avoid compiler statements and not have to:
code:
#if canImport(AppKit) && !targetEnvironment(macCatalyst)
static let topLeft = .minXMaxY
#else
static let topLeft = .minXMinY
#endif
I know you can also flip the geometry of a CALayer and that would probably be easier because that way I could just have the iOS drawing routine and just flip the origin for macOS, but again I don’t know if there is a way of doing that other than #if AppKit layer.isGeometryFlipped = true.

Aside from flipping the layer on Mac (which is probably what I'd do (and I don't know a better way than setting that property, you could maybe define your own factory method on each layer type and set the property as appropriate?)), you could move the #if into an extension property on CACornerMask. e.g.
Swift code:
extension CACornerMask {
  static var topLeft: CACornerMask {
    #if canImport(AppKit) && !targetEnvironment(macCatalyst)
      return .minXMaxY
    #else
      return .minXMinY
    #endif
  }
}

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

luchadornado posted:

Posting here since I couldn't figure a better place: I want to make a TUI (probably prototyping with Python's Rich library or similar). Making an iOS app is out of the question for the short time frame I've given myself.

Is there a proper terminal app for ipad yet (guessing no) or am I looking at an SSH client? What are the best options for either?

Pythonista is a Python environment that's been around forever and still seems updated. Blink, maybe, for ssh? I don’t have enough experience with either to give a proper recommendation.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Or delete the typealias and see if it can be inferred?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
No idea but have some uninformed flailing: is the header ever included or imported in a non-c++ context (don't forget about bridging headers)? Does renaming it to .hpp change anything?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

uncle blog posted:

About to get a new Mac from work. Going to be a Pro with M1-something. How important are the gpu cores when running live previews in SwiftUI? My current one is rear end slow. And what other specs should I aim for on a machine made to develop both iOS and web, and often running some Docker containers/local dev env, and maybe the occasional game?

I haven't done any research or anything, but my answers are: gpu cores won't make any noticeable difference; more memory is maybe better otherwise no noticeable difference.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Can you make a proper initializer for MyView that takes a Coordinator, then initialize the view model from there? (Though I'm not sure if the AppData instance is available at that point.)

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

KidDynamite posted:

am i burnt out or was wwdc kind of meh this year?

I'm feeling more sad about "looking forward to using this in a few years when I bump a min sdk requirement" than usual, which is maybe a sign that I'm more excited about what I've seen so far.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
rip Three20 framework

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

KidDynamite posted:

hey I have 3k I can spend and get reimbursement from work. What swift resources would y’all spend this money on? Bonus points if it will help land a new job.

Already have objcio and pointfree on the list.

Donny Wals has a couple books. I've not read them but their blog is great, so maybe worth a look.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

uncle blog posted:

If I revoke my Development and Distribution certificates, apps already on the App Store will be unaffected?

Correct.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Shortest answer is define your own init and call the designated super.init, which is probably init(configuration:delegate:delegateQueue:).

Maybe better answer is make a protocol Session, declare the methods of URLSession that you use, then conform URLSession to it. Make your MockSession conform to the protocol instead of subclassing. Then have your ApiClient take an instance of the protocol instead of a URLSession.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Small White Dragon posted:

I've been out of the iOS game for a while, and I have a Xamarin app that runs fine on iOS.

Are launch images still supported these days, or is that no longer supported?

Is there a way to handle the iPad status bar and make sure I can accept touches under that area?

A launch storyboard is required. I don't know if you can supplement it with launch images and if so for what resolutions.

You can hide the iPad status bar. When it's visible, there are buttons in it (back button in top left (after following a link to another app) and multitasking button in the middle), but I don't know what happens to touches in the foreground app. If you've been out long enough that you're not sure what the safe area is, that might be useful reading to help arrange views up there. https://useyourloaf.com/blog/safe-area-layout-guide/ looks like a decent summary.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

SaTaMaS posted:

How do you make a deep copy of a Set in Swift? I'm trying to transfer a Set containing a Core Data relationship from one thread to another, and I'm getting a Core Data error which I'm pretty sure is because of the bridged NSSet reference hiding in the Set type.

You don't need a deep copy, you need a shallow copy :)

Probably the best way overall would be to take a set of managed object IDs from the source thread and reify them back into managed objects on the destination thread:
Swift code:
// source thread
let ids = coolObject.relatedObjects.map(\.objectID)
// destination thread
let objects = ids.map { context.object(with: $0) }
However, if you really want the objects themselves in a non-Core Data set, try
Swift code:
var copy: Set<RelatedObject> = []
copy.formUnion(coolObject.relatedObjects)

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

101 posted:

Welp, I got an offer I couldn't refuse from a company whose app is built entirely in SwiftUI. Guess I'm gonna have to get to grips with it.

Congrats!

Also lol

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Small White Dragon posted:

Is Xcode 14.1 not out yet? I wasn't sure if upgrading to iOS 16.1/iPad OS 16.1 would cause issues with Xcode 14.0.

I saw the 14.1 release candidate was out end of last week (by which I mean it was available in whatever feed the Xcodes app polls, idk about App Store).

Heads up though it has a Swift Concurrency bug that wrecks the AsyncSequence backport, if you have any iOS devices <15 you'll wanna keep Xcode 14.0.1 around still.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Plorkyeran posted:

There's a second Xcode 14.1 RC out so I guess there was a problem with the first.

https://developer.apple.com/documentation/xcode-release-notes/xcode-14_1-release-notes mentions some concurrency issues. Nothing about AsyncStream though, wonder if that's fixed too. I'll try it out!

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

pokeyman posted:

https://developer.apple.com/documentation/xcode-release-notes/xcode-14_1-release-notes mentions some concurrency issues. Nothing about AsyncStream though, wonder if that's fixed too. I'll try it out!

This was indeed fixed. 14.1RC2 is a winner!

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?

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!

pokeyman
Nov 26, 2006

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

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!

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.

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.

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.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Small White Dragon posted:

EDIT: Also, I assumed that "UISupportsTrueScreenSizeOnMac" flag means iOS app windows can be resized but I guess not?

I believe you also need to opt out of (or not opt in to, I forget which) requiring full screen. It's the same Info.plist key that makes your app usable in Split View on an iPad.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Are there any other errors? It's possible it's a constraint issue but I wonder if that console spew is overshadowing something else.

I wouldn't expect a JSON blob to be shareable as an image, but I would expect the activity view controller to appear nonetheless even if it doesn't offer many actions.

I think if you set the Info.plist keys for "allows iTunes document sharing" and "opens files in place" then your app's Documents directory will appear in the Files app. You could save images that way?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
JSONEncoder.encode() returns a Data, which you're putting into your dictionary. Try encoding the whole dictionary:
Swift code:
var params: [String: Any] = [:]
params["foo"] = bar
let encoded = JSONEncoder().encode(params)

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
getImage (conceptually) returns an immutable copy of the struct. So you can't call a mutating method directly on it, and if you took a mutable copy (i.e. assigned the return value to a var) it wouldn't help you because it's a copy.

I would use the updateState method you added to ImagesViewModel. Though I wonder if you'll have the same problem in its implementation? You may need to switch to using firstIndex(where:) instead, so the mutation can write back.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Small White Dragon posted:

Where do you find crash reports on App Store Connect these days? I know they used to be there...

For beta releases, in the TestFlight section of your app.

For App Store releases, in Xcode in the Organizer window.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Yeah I'm a good 15 pages behind the Awful.app thread, gotta catch up. Ditching Imgur is on my list, and I appreciate the GitHub issue!

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
That sequence number is approaching 2^32 but I have no idea how suspicious to be of that.

Is anything in https://developer.apple.com/documentation/network/debugging_https_problems_with_cfnetwork_diagnostic_logging helpful?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I have no suggestions from experience, but when I poke around the Swift stdlib or stdlib-adjacents like swift-collections I see a lot of annotations and private storage types and such that must be partly for performance optimization. Could give you something to look up at least?

Speaking of swift-collections, https://github.com/apple/swift-collections-benchmark might be of use.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
In the first example, @Query is a DynamicProperty that tells SwiftUI about changes to the list of groups, including changes to any of its elements, and that triggers a render. The views in the tree at this point change when the count changes, so there's a diff and you see the new view.

In the second, I think what happens is the GroupTile has a plain old group property that makes the view tree look identical. So the Query picks up the change as before, but the render pass creates an identical GroupTile so it looks like there's no diff from the previous tree. I think you want an @ObservedObject in front of GroupTile's group.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I don't think ViewBuilder makes a difference here, it's generating the whole tree vs. having a separate custom view. Like if you drop the @ViewBuilder and return a View the old fashioned way, I would expect no difference in behaviour. (Maybe that's obvious but one less variable in the confusion?)

I'm fairly sure Core Data objects emit KVO notifications when a relationship's count changes, so I wonder if a) I'm wrong about that b) NSManagedObject's ObservableObject implementation is completely separate from KVO or c) SwiftData works differently.

What happens if your GroupTile stores properties derived from the Group? Like a let name: String and let deviceCount: Int.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Does the newer (but still years old) Core Data external changes notification get posted by SwiftData? NSPersistentStoreRemoteChange I think.

Also I don't think there's any need to make your MyFancyModelActor method async in that example. It's already asynchronous with respect to other actors.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I think you just saved future-me a few hours of frustration so thank you for writing that out. Wish I had any other ideas :(

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Small White Dragon posted:

Seems like every time I hook up my iOS device to test, the "trust this computer?" prompt re-appears. Is there no a longer way to tell it to always trust this same computer?

My ipad asked me twice today and I was pretty sure I had trusted it before. And after the second time I failed to notice it wasn’t charging, so it just blinked out after a few hours. Not sure what’s up but you’re not alone.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I have no useful experience but from reading the docs I know FetchRequest has initializers that take an Animation or a Transition, do those do anything helpful?

Adbot
ADBOT LOVES YOU

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Where on earth did pkl come from?

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