@jonduenas@mastodon.world
@jonduenas@mastodon.world avatar

jonduenas

@jonduenas@mastodon.world

iOS software engineer. I make FourSix Coffee App in my spare time.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

christianselig, to random
@christianselig@mastodon.social avatar

SwiftUI noob question: I understand why my ViewModel is being initialized twice, but why is it not being deinitialized?

It's created, then a second later when appState.show is changed, the view is recomputed, and view, and its ViewModel, are created anew. Cool! But why is the old one not deinitialized? What's holding onto it?

Sample code: https://gist.github.com/christianselig/d88b1a4d1989b973689ae62d4691162f

jonduenas,
@jonduenas@mastodon.world avatar

@christianselig What does the memory graph show? Do you have 2 held in memory? What happens if AppState changes again? I wonder if SwiftUI is doing some unknown “magic”. I wouldn’t expect SpecialView’s state to be lost when AppState changes. So tossing and reinitializing doesn’t make sense to me.

davidbures, to SwiftUI
@davidbures@mstdn.social avatar

I need some design help, I’m not good at iOS development 😅

I have this screen. Originally, it was called “Dictionary”. This is where you look up words.

Then, due to SwiftUI being annoying, I had to add another title to that bottom sheet. Because that technically is also a part of the dictionary, I also gave it the title “Dictionary”. See pic no2 for what inside that bottom sheet.

But now I have the same title on the same screen twice, which is bad.

How would you solve it?

#swiftui #iOSDev

jonduenas,
@jonduenas@mastodon.world avatar

@davidbures Is there supposed to be some other content that will fill the parent view? Like the part that currently says “Look up internet slang”? The way it’s presented now it feels like it’s just there to tell you to use the bottom sheet.

As for the bottom title, “Search” seems reasonable.

jonduenas,
@jonduenas@mastodon.world avatar

@davidbures @ctietze Hmm. Could still make sense if those are really just search suggestions essentially right? If not, I’d put the word of the day and random words somewhere else entirely like a Home tab or something. But seems like you’re trying to go for a single screen app, so that might change a lot more.

jonduenas,
@jonduenas@mastodon.world avatar

@davidbures @ctietze Seems like you’re going more for the Maps like search experience. I’d take inspiration from that app if that’s what you’re going for. But, the background map screen is different than what you’re doing content-wise, so may or may not make sense.

jonduenas,
@jonduenas@mastodon.world avatar

@davidbures Yeah that’s SwiftUI for ya 😅 . It’s very difficult to go outside Apple’s established design language. Not sure what to suggest other than trying to not use searchable, dipping into UIKit, or just ignoring your user complaints lol.

jonduenas,
@jonduenas@mastodon.world avatar

@davidbures You said you HAVE to use searchable? Any way around that requirement? Rolling your own from scratch would give more flexibility.

jonduenas, to swift
@jonduenas@mastodon.world avatar

Alright, might be time to abstract #SwiftData in my app. Who has the best example? Should I use a ModelActor? Would a class holding a ModelContainer be sufficient if I create a new ModelContext inside the CRUD functions? #iosdev #swift

jonduenas,
@jonduenas@mastodon.world avatar

@davidbures Lol I’m mostly trying to extract my reliance on SwiftData everywhere. If something causes the ModelContainer to fail to initialize, my app still has functionality to offer. In fact, free users don’t even access the database at all. So, doesn’t make sense to fatalError or block the entire app loading. “Abstraction” is probably a step past what I need though, so maybe I should ask for examples of moving SwiftData out of SwiftUI first.

jonduenas, to random
@jonduenas@mastodon.world avatar

Trying to build a #SwiftData predicate with even the slightest bit of complexity is a nightmare. I only have 4 properties to filter on and the compiler completely chokes when building the macro.

jonduenas, to random
@jonduenas@mastodon.world avatar

Well, got my first App Store rejection. And for a reason they somehow missed in my previous two builds. #iOSDev

MuseumShuffle, to SwiftUI
@MuseumShuffle@mastodon.social avatar

I'm using this exact code from the Apple documentation example for using .dateTime but the date and time output is adding an "at" that I can't figure out how to get rid of.

#SwiftUI

jonduenas,
@jonduenas@mastodon.world avatar

@MuseumShuffle Not sure you’ve seen this site before but it’s the most thorough documentation I’ve seen of the new formatting options. If the answer isn’t here, it really is a mystery https://fuckingformatstyle.com/date-styles/

jonduenas, to random
@jonduenas@mastodon.world avatar

So I'm trying to save a Codable struct into a #SwiftData model, but it crashes on read because it doesn’t like that the struct has an array of Doubles in it? What the hell?

jonduenas,
@jonduenas@mastodon.world avatar

ValueTransformers are a thing that I hoped #SwiftData would remove the need for. Ugh. More and more each day I want to just rip it out and replace it with GRDB or Boutique. #iosdev

jonduenas,
@jonduenas@mastodon.world avatar

@dgoldsmith Ill try and create a small project to reproduce and file the FB. But do you know if this is expected? I know transformable attribute is a thing.

jonduenas,
@jonduenas@mastodon.world avatar

@dgoldsmith FB13049208

jonduenas,
@jonduenas@mastodon.world avatar

@dgoldsmith Lol fair, but I guess I just meant that I know arrays in Core Data often required hoops to jump through to work right. And I know ValueTransformers are still a thing. I assumed I didn’t need to do anything special since I’m not trying to do anything weird, but I don’t know if my assumption is wrong.

jonduenas,
@jonduenas@mastodon.world avatar

@groue Oh shit, shots fired lol

Joking aside, I’ve heard good things. Just trying to wrap up some other features before I try it out.

jonduenas,
@jonduenas@mastodon.world avatar

@groue At least there’s no danger of you getting Sherlocked! Even if it were completely working, there are aspects of it that I’m not a fan of, much like Core Data. Always good to have alternative options.

okla, to SwiftUI
@okla@mas.to avatar

Not sure if this Observable macro usage supposed to leak memory or is it a bug? Deinit is never called for the view model.

#SwiftUI #ios17

jonduenas,
@jonduenas@mastodon.world avatar

@okla Interesting. And you confirmed you have multiple instances still in memory in the memory graph? If so, this seems like a serious bug worth reporting.

davidbures, to swift Czech
@davidbures@mstdn.social avatar

I have a pretty simple Swift/SwiftUI question, I think I’m missing something basic.

I have this code: https://pastes.io/x9k2gkfutj

The function getProxySettings can throw. I have declared an Error enum for it called ProxyRetrievalError. This function can throw this error type only.

Now, I’m trying to execute this function in an .onAppear, but I’m getting the error in the attached picture.

How do I fix this while still being able to switch over the thrown error?

#swift #swiftui

jonduenas,
@jonduenas@mastodon.world avatar

@ctietze @davidbures @pagessin There's been conversation in the Swift community about this. Generally, throws over a Result type is by design. It forces you to explicitly handle the error. Real solution is for Swift to have typed throwing errors, but I don't know if that'll happen or not. Found this proposal but it's a few years old https://forums.swift.org/t/typed-throws/39660/202

jonduenas,
@jonduenas@mastodon.world avatar

@ctietze @davidbures @pagessin IMO the beauty of throwing functions is being able to propagate the error up the chain to the place that actually cares about an error.

jonduenas, to SwiftUI
@jonduenas@mastodon.world avatar

I spent sooooooo many hours on my coffee timer app building a timer first with Timer, then with Combine. Now, I find out that iOS 16 has this SwiftUI Text initializer and 🤯 I don’t have to worry about updating a time interval firing at all anymore. I can just update some Date properties and the text will update for me. This is going to DRASTICALLY simplify my code. #iosdev #swiftui https://developer.apple.com/documentation/swiftui/text/init(timerinterval:pausetime:countsdown:showshours:)

jonduenas, to random
@jonduenas@mastodon.world avatar

Getting all the way to the end of interviewing with a company and then finding out they went with someone else is brutal. Especially in tech where interviews are weeks long with multiple stages.

jonduenas,
@jonduenas@mastodon.world avatar

If you know anyone hiring remote mid-senior level iOS Engineers, let me know! #swift #swiftlang #swiftui #iosdev

christianselig, to random
@christianselig@mastodon.social avatar

Here's a little sneak peek for what would have been Apollo for iPad. You have stackable panes allowing you to easily view and move through multiple things at once (or go full screen!), Gallery Mode, and sections are moved to the side, with support for opening new tabs

jonduenas,
@jonduenas@mastodon.world avatar

@christianselig This alone would have made me want to buy an iPad 😢

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • kavyap
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • InstantRegret
  • GTA5RPClips
  • Youngstown
  • everett
  • slotface
  • rosin
  • osvaldo12
  • mdbf
  • ngwrru68w68
  • JUstTest
  • cubers
  • modclub
  • normalnudes
  • tester
  • khanakhh
  • Durango
  • ethstaker
  • tacticalgear
  • Leos
  • provamag3
  • anitta
  • cisconetworking
  • lostlight
  • All magazines