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
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


eschaton posted:

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

I suppose so!

Adbot
ADBOT LOVES YOU

Small White Dragon
Nov 23, 2007

No relation.
Is there a name for the thing that lets you run iOS apps on an ARM Mac? I found an issue exclusive to this scenario but it's hard to google for.

go play outside Skyler
Nov 7, 2005


Small White Dragon posted:

Is there a name for the thing that lets you run iOS apps on an ARM Mac? I found an issue exclusive to this scenario but it's hard to google for.

XCode just calls it "designed for iPad" as far as i know.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
Mac Catalyst?

Fate Accomplice
Nov 30, 2006




anyone have any insight into NSUserActivity?

I'm doing a hackweek project to get some of our app data indexed in iOS spotlight, and I've gotten the NSUserActivity / CSSearchableItem created and indexed, but when I tap on our item in the search results in the simulator, my app opens, but the NSUserActivity I'm handed has its webpageUrl set to nil, so I can't deep link it properly.

is there some set of requiredUserInfoKeys or similar I need to include to make sure the webpageUrl I created gets passed along?

Small White Dragon
Nov 23, 2007

No relation.

rjmccall posted:

Mac Catalyst?

I think this is a toolkit for building iOS and MacOS applications simultaneously. I'm just referring to the ability to run an iOS app/game on an ARM Mac, even one that wasn't necessarily designed with this in mind (although developers can specifically prohibit this).

haveblue
Aug 15, 2005



Toilet Rascal

Small White Dragon posted:

I think this is a toolkit for building iOS and MacOS applications simultaneously. I'm just referring to the ability to run an iOS app/game on an ARM Mac, even one that wasn't necessarily designed with this in mind (although developers can specifically prohibit this).

https://developer.apple.com/documentation/apple-silicon/running-your-ios-apps-in-macos

This page doesn't use a specific term to name the feature, it's just a build/distribution option to share the same binary instead of making two, or to make it iOS-only, and it's allowed by the existence of Catalyst. So it's probably correct to refer to doing this as "using Catalyst".

Can you say more about the issue you're encountering?

haveblue fucked around with this message at 19:16 on Jan 15, 2023

Froist
Jun 6, 2004

Small White Dragon posted:

Is there a name for the thing that lets you run iOS apps on an ARM Mac? I found an issue exclusive to this scenario but it's hard to google for.

The (publicly known, I’m not an insider) codename for this was Marzipan, so while I think Catalyst is the correct term for it, this might bring up some more/different results.

commie kong
Mar 7, 2019

Small White Dragon posted:

Is there a name for the thing that lets you run iOS apps on an ARM Mac? I found an issue exclusive to this scenario but it's hard to google for.

How about universal binaries?

https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary

They also use "silicon" while referring to compatible macs, which might help your searches

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
Catalyst is a hybrid framework stack which provides iOS APIs on macOS. You can build for it directly, but it can also just launch apps built for iOS (only on Apple Silicon Macs, though; there’s no ARM/ARM64 emulator involved). In either case, you’re using the Catalyst framework stack, which shares some but not all dylibs with the “normal” macOS stack (and also changes some behaviors).

There aren’t any designed behavior differences between Catalyst and iOS AFAIK, but of course it’s far too complex for that to be possible.

Small White Dragon
Nov 23, 2007

No relation.

commie kong posted:

How about universal binaries?

https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary

They also use "silicon" while referring to compatible macs, which might help your searches

Just to clarify, I'm just talking about the ability to run iOS apps on ARM-based Macs, rather than building a dual iOS/Mac app. Yes, I realize the later can be done, but right now some apps can't due to other technical or contractual issues.


haveblue posted:

https://developer.apple.com/documentation/apple-silicon/running-your-ios-apps-in-macos

This page doesn't use a specific term to name the feature, it's just a build/distribution option to share the same binary instead of making two, or to make it iOS-only, and it's allowed by the existence of Catalyst. So it's probably correct to refer to doing this as "using Catalyst".

Can you say more about the issue you're encountering?

I actually think I tracked it down. The issue was about keypresses in a third-party library. Turns out their UIView called [super ...] on a lot of the presses handlers, which would cause MacOS to emit a system beep for certain keys even if the keypress was handled.

Not many people test iOS apps this way on Macs (and I don't blame them, I'm not sure how to offhand), so it's unsurprising to me that it wouldn't get noticed.




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

Small White Dragon fucked around with this message at 04:04 on Jan 16, 2023

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.

duck monster
Dec 15, 2004

If anyone wants a fun project that would make me, and about a billion other cat owners rather fond of you.

https://github.com/kisonecat/CatNip

This thing used to be great. Every time my cat would jump on the keyboard, it would immediately lock the keyboard and require a human action to unlock it. Theres a PC equivelent Pawsense that can also play harmonica noises very loudly which upsets cats and makes them flee. Very useful (And hopefully teach them not to jump on the keyboard).

Unfortunately in the 12+ years since its last update its suffered a lot of bit rot. The carbon APIs it relied on are *long* since redundant.

It shouldnt be TOO hard to recusitate it (or just recreate it, it wasnt complex. Just intercept the keyboard, look for keypresses in clusters, and then throw a full-screen up over the the screen), but alas I dont have the time to do it myself.

So if anyones up for a project....

dupersaurus
Aug 1, 2012

Futurism was an art movement where dudes were all 'CARS ARE COOL AND THE PAST IS FOR CHUMPS. LET'S DRAW SOME CARS.'
Any suggestions for guides for learning iOS dev when you're already a programmer, like patterns and best practices and poo poo? I can pick up Swift no problem as I go along, but I'm wondering about things that one might not pick up on without working professionally.

edit: webdev is my day job but I've got history in a bunch of other stuff

Graniteman
Nov 16, 2002

dupersaurus posted:

Any suggestions for guides for learning iOS dev when you're already a programmer

Maybe check out the Stanford CS193p course. It may be too basic for you, but it’s the most advanced intro I’ve personally seen. It is the full Stanford course on iOS development. The students are expected to have completed their first year of classes, and know 3-4 languages, and have understanding of basic programming topics.

All of the other online “learn swift” stuff I’ve seen is targeted at people who don’t know how to program, and the material is very hand-holdy. The Stanford course assumes you are smart and are going to do some homework and figure stuff out on your own.

jabro
Mar 25, 2003

July Mock Draft 2014

1st PLACE
RUNNER-UP
got the knowshon


https://cs193p.sites.stanford.edu

That's the Stanford site for the class.

Stringent
Dec 22, 2004


image text goes here
there's a bunch of stuff on youtube, but i don't know of any good accounts or anything. i'm sure one or another of them is doing something that isn't too outlandish.

former glory
Jul 11, 2011

I can vouch for the Stanford course. I used that and referred to the swift language tour throughout and it got me comfortable with it quickly as an experienced dev.

https://docs.swift.org/swift-book/GuidedTour/GuidedTour.html

The guy builds 3 or 4 apps in real-time and takes some occasional turns into .ppt slides that are really concise to cover key patterns and concepts. You come out of it with a good grasp of how to build things the standard swiftui way by leaning on the MVVM pattern with heavy focus on declarative UI building, publishers, bindings, special swift enums using associated data - stuff like that off the top of my head.

dupersaurus
Aug 1, 2012

Futurism was an art movement where dudes were all 'CARS ARE COOL AND THE PAST IS FOR CHUMPS. LET'S DRAW SOME CARS.'
I'll check the Stanford thing out, thanks

toiletbrush
May 17, 2010
I've written a quite dodgy app using SpriteKit for doing ascii art for another game I'm writing. I've got a 'gallery' screen to view images and drawing and everything else working, but I can't figure out how to share images made in the app outside of it, e.g to my Mac.

I tried using UIActivityViewController...
code:
let data = try! JSONEncoder().encode(gamescene.screen.currentBuffer)
let activity = UIActivityViewController(activityItems: [data], applicationActivities: nil)
activity.popoverPresentationController?.sourceView = gamescene.view

let controller = gamescene.view!.window!.rootViewController!
controller.present(activity, animated: true)
...but no matter what I set as the sourceView, I get a massive error that seems to boil down to the layout manager being 'Unable to simultaneously satisfy constraints'. Is there a way to use UIActivityViewController from inside a SpriteKit app?

Is there a way to directly save to the folder that Files uses, so I can share from there? Or get to the documents folder of an app from Files? Or something else I can do?

toiletbrush fucked around with this message at 00:47 on Mar 8, 2023

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?

toiletbrush
May 17, 2010
I've trawled through the spew and it's all to do with constraints, but I might have missed something.

Yeah I was hoping that you can use that controller to share more than just images, it seems to accept lots of different things. I can't share the 'images' as a png or whatever though as they need to be imported into my game as character + palette data so the game can render it as chars rather than a texture. JSON is a bit wasteful but these images are like 40 x 20 so not too bothered.

The tip about the plist keys might be good enough, I'll try it asap, thanks!

Edit: the iTunes/open-in-place trick worked! not totally ideal but its good enough for now

toiletbrush fucked around with this message at 22:00 on Mar 9, 2023

Ihmemies
Oct 6, 2012

So I guess app development is hell in iOS side if you want something like:
- an alarm clock with custom ringtones, fade-in sound so the alarm sound stats quiet, increases over time.
- support for multiple simultaenous timers with custom names

Those were built-in in Google Clock, and are sorely missing from Apple's Clock.

KidDynamite
Feb 11, 2005

so I am working to change work.app over to Codable.

when encoding a parameter to be sent over i add it to a dictionary like so

Swift code:
var params: [String: Any] = [:]
params["foo"] = JSONEncoder().encode(bar)
for some reason the parameter's value is set to it's size in bytes rather than the json it prints when i do

Swift code:
po String(decoding: JSONEncoder().encode(bar)!, as:  UTF8.self)
results in a JSON string

Swift code:
po params["foo"] 
results in

code:
&#9663; Optional<Any>
  &#9663; some : 1228 bytes
    - count : 1228
    &#9663; pointer : 0x0000000159937000
      - pointerValue : 5797801984
i'm real confused as to what the hell is going on. encoding works fine for certain models and then shits itself like this for others. any suggestions?

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)

SaTaMaS
Apr 18, 2003

Ihmemies posted:

So I guess app development is hell in iOS side if you want something like:
- an alarm clock with custom ringtones, fade-in sound so the alarm sound stats quiet, increases over time.
- support for multiple simultaenous timers with custom names

Those were built-in in Google Clock, and are sorely missing from Apple's Clock.

There's probably third party apps that do those?
https://apps.apple.com/us/app/alarmy-alarm-clock-sleepsound/id1163786766
https://apps.apple.com/us/app/sleep-cycle-sleep-tracker/id320606217

Pope Hilarius
May 3, 2007

@rjmccall do you know about why the objc_direct attribute was introduced in clang? Saw your name on the proposal and would love to hear the story if you know any deets!

Pope Hilarius fucked around with this message at 18:17 on Apr 19, 2023

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
It’s not specifically for Facebook, but yes, the idea is to eliminate some of the overhead and surface area of ObjC methods in cases where it’s not needed or wanted. The overhead is, briefly, (1) the binary-size cost of selectors and method table entries, (2) the load-time execution cost of eagerly uniquing selectors, (3) the call-time execution cost of message send, and (4) the call-time memory cost of keeping methods in method caches. The surface area impact is that normal ObjC methods are overridable and swizzleable, which can create accidental binary-compatibility headaches (and, admittedly, also allow clients to work around bugs) and potentially even introduce security problems.

KidDynamite
Feb 11, 2005

open source Foundation preview has been put up. going to enjoy poking around that code base. json decoding is improved 200-500%

https://github.com/apple/swift-foundation

SaTaMaS
Apr 18, 2003
Are there any LLMs that are more up to date for Swift than ChatGPT with its 2021 cutoff?

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?
Gods I hope not.

jabro
Mar 25, 2003

July Mock Draft 2014

1st PLACE
RUNNER-UP
got the knowshon


Bard supposedly is more up to date because it uses current Google search queries but not too sure how that makes it more accurate. Less phantom responses I suppose.

Corb3t
Jun 7, 2003

The Browser Company/Arc is working on shipping a toolchain to develop cross-platform Mac/Windows apps, programmed in Swift using VSCode.

uncle blog
Nov 18, 2012

I'm trying to mutate a struct instance in an array contained within a ViewModel class, but I'm getting the error "Cannot use mutating member on immutable value: function call returns immutable value".

This is the struct model.
code:
public struct IdentifiableImage: Identifiable {
    
    public enum UploadState {
        case uploading
        case finished
        case failed
    }
    
    public mutating func updateState(_ state: UploadState) {
        self.state = state
    }
    
    public let id: String
    let image: UIImage?
    var state: UploadState?
    
    public init(image: UIImage?, id: String, uploadState: UploadState = .finished) {
        self.id = id
        self.image = image
        self.state = uploadState
    }
}
And this is the viewmodel containing the array of the struct.
code:
public final class ImagesViewModel: ObservableObject {
    @Published private(set) var images: [IdentifiableImage]
    
    public func getImage(with id: String) -> IdentifiableImage? {
        images.first( where: { $0.id == id })
    }
    
    public func updateState(for imageId: String, with state: UploadState) {
       images.first(where: { $0.id == imageId })?.updateState(state)
    }
    
    public init(images: [IdentifiableImage] = []) {
        self.images = images
    }
}
Outside this class, I try to call
code:
imagesViewModel.getImage(with: id)?.updateState(.failed)
Which gives me the error "Cannot use mutating member on immutable value: function call returns immutable value"
Any tips for what I'm doing wrong?

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.

Graniteman
Nov 16, 2002

uncle blog posted:

I'm trying to mutate a struct instance in an array contained within a ViewModel class, but I'm getting the error "Cannot use mutating member on immutable value: function call returns immutable value".

Any tips for what I'm doing wrong?

This code
code:
imagesViewModel.getImage(with: id)?.updateState(.failed)
is the same as this code:
code:
let temp: IdentifiableImage? = imagesViewModel.getImage(with: id)?
temp.updateState(.failed)
The chaining doesn't pass back to the view model. Written out like this it should be obvious that it can't work. You need something like this:

code:
public func updateState(for imageId: String, with state: UploadState) {
       guard let index = images.firstIndex(where: { $0.id == imageId }) else { return } // throw
       var updatedImage = images[index]
       updatedImage.updateState(state)
       images[index] = updatedImage
    }
Now your call site would look like this:

code:
imagedViewModel.updateState(for: id, with: .failed)

Falcorum
Oct 21, 2010
Not sure if this is the right place, but how usable is Swift on Windows now? I know some stuff won't be available (SwiftUI) but I'm mostly wondering if there's anything like core parts of the language that might be technically supported, but sketchy to use on Windows, and other gotchas.

For context, I'm looking to experiment with a new language for some personal projects (mostly CLI stuff, potentially involving Vulkan at some point) and Swift seemed pretty promising and would be a more interesting option than me just falling back to my usual goto, C++.

Small White Dragon
Nov 23, 2007

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

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.

Adbot
ADBOT LOVES YOU

Hadlock
Nov 9, 2004

:siren: :pcgaming:

Looks like Imgur has announced they've stopped* allowing anonymous uploads, and plan to purge (soon!) all anonymously uploaded images at some point in the future

And awful.app is continuing to allow goons to upload to imgur (For now) and those images will likely be wiped out soon. Apparently if you're logged in to imgur those images will not be purged, but the awful.app only supports anonymous uploades

Suggested course of action is to disable imgur upload from in-app immediately, then add new image upload feature in the future

github issue: https://github.com/Awful/Awful.app/issues/1163
thread: https://forums.somethingawful.com/showthread.php?threadid=3837546&userid=0&perpage=40&pagenumber=1

forum-wide thread about the imgur "crisis" https://forums.somethingawful.com/showthread.php?threadid=4030290&pagenumber=15#post531890604

The reason I'm posting here is that I've seen several reports across three different threads that "development has stalled" on the iOS app and we may need someone to take over until the current maintainers return. I'd help but i'm not an iOS dev so my spin up time would be long and glacial

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