@Mecid@mastodon.social
@Mecid@mastodon.social avatar

Mecid

@Mecid@mastodon.social

Swift developer 👨🏻‍💻SwiftUI addicted 🚀Creator of CardioBot app for⌚️and📱Writing weekly posts about Swift development 📖

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

oskargroth, to random
@oskargroth@mastodon.social avatar

How many SO answers does it take to limit the number of characters in a SwiftUI TextField?

20 answers and still no good solution 😅

https://stackoverflow.com/questions/56476007/how-to-set-textfield-max-length

Mecid,
@Mecid@mastodon.social avatar

@oskargroth how about this one?

Mecid,
@Mecid@mastodon.social avatar

@oskargroth on the iOS it works without any delays, can’t verify it for macOS at the moment.

Mecid,
@Mecid@mastodon.social avatar

@schwa @oskargroth what do you mean by “strictly necessary”? I think an all logic defines the necessity of the state update. Things like data or input validation can run almost simultaneously to the input.

StewartLynch, to SwiftUI
@StewartLynch@iosdev.space avatar

I have come across something with the Observation framework that is confusing me so if there are any Observation framework experts out there that can explain this to me, I would be forever grateful. Why I don’t have to define the object as a State object?

video/mp4

Mecid,
@Mecid@mastodon.social avatar

@StewartLynch whenever the parent recreate your view you will lost the value of your observable object. That’s why we have @State to survive during view recreation.

dimillian, to random
@dimillian@mastodon.social avatar

I took great care of iPad support. @IceCubesApp uses the iOS (TabBar) layout when the size class changes to a compact width. On regular width size classes, the app uses a custom sidebar layout. All that with SwiftUI, without reloading any root view so state is kept.

video/mp4

Mecid,
@Mecid@mastodon.social avatar

@amyworrall @dimillian @IceCubesApp you can use the same binding for tabs in different layouts.

Mecid,
@Mecid@mastodon.social avatar
Mecid, to random
@Mecid@mastodon.social avatar

@dimillian can I somehow sync timeline position between ice cubes on macOS and iOS?

Mecid,
@Mecid@mastodon.social avatar

@dimillian can we have a shortcut for “resume”?

Mecid,
@Mecid@mastodon.social avatar

@dimillian yeah manually syncing timeline is a bit confusing. But at least having a shortcut for this action is important.

Mecid, to random
@Mecid@mastodon.social avatar

The contentMargins view modifier shifts only scrollable content away from the safe area. But it keeps the scrollbar on the trailing edge of the view.
https://buff.ly/3Uq6QkN

Mecid, to random
@Mecid@mastodon.social avatar

Any active podcasts about Swift dev?

Mecid,
@Mecid@mastodon.social avatar

@twostraws @swiftovercoffee that is a great show brought me back to the podcast world. Thank you 🙏🏻

zachsimone, to random
@zachsimone@mastodon.social avatar

I like the look of this chart in App Store Connect, but is there a chance Petty made almost AU$800k in the last couple of hours?

[Phil Gould voice] No no no no no!

Mecid,
@Mecid@mastodon.social avatar
Mecid, to random
@Mecid@mastodon.social avatar

The recent version of the SwiftUI framework introduces a trigger value pattern across its APIs. Trigger value allows us to attach a view modifier that runs its action whenever the trigger value changes. This week, we will learn how to build custom view modifiers using trigger value pattern.
https://buff.ly/4cIaqhq

Mecid, to random
@Mecid@mastodon.social avatar

We use the new AnyLayout type to erase the actual type of the layout that depends on the current horizontal size class. The structural identity of our view stays the same. In this case, the SwiftUI doesn’t recreate the views It only moves them.
https://buff.ly/3MpSzjQ

seanallen_dev, to random
@seanallen_dev@mastodon.social avatar

New video on my YouTube channel all about SwiftUI toggle buttons and switches.

The newer toggle buttons with a content transition provide a nice little animation.

video/mp4

Mecid,
@Mecid@mastodon.social avatar

@brandonhorst @seanallen_dev I’v added https:// to all the links, but @ivory on iPhone doesn't linkify them.

Mecid,
@Mecid@mastodon.social avatar

@brandonhorst @seanallen_dev @ivory strange, I didn't change anything.

dimillian, to random
@dimillian@mastodon.social avatar

@IceCubesApp is featured in this week's story about the news app on the App Store! https://apps.apple.com/us/story/id1732341630

Mecid,
@Mecid@mastodon.social avatar

@dimillian @IceCubesApp well deserved!

Mecid, to random
@Mecid@mastodon.social avatar

In this example, we introduce the content property on the ContentView type. The content property isn’t isolated to the main actor, so both functions will run on the cooperative thread pool.
https://buff.ly/43oknwc

Mecid,
@Mecid@mastodon.social avatar

@schwa @MainActor I’m totally agree with you. I think the whole view should isolate to the main actor.

Mecid, to random
@Mecid@mastodon.social avatar

The Swift language allows us to define thread-safe types using actors. Actor type automatically manages serial access to the data it protects. But what if we need multiple types protected by a single serial access queue? That’s why we have global actors, and today, we will learn how to use global actors in Swift.
https://buff.ly/3uYQqGl

Mecid, to random
@Mecid@mastodon.social avatar

How do you deal with dynamic type in your apps? Do you embed every screen in scroll view? I solve this problem using ViewThatFits view and embed my content into scroll view only when it doesn't fit.
https://buff.ly/3qX5bXZ

Mecid, to random
@Mecid@mastodon.social avatar

Another tree-based structure that the Swift Collections package provides us is the Heap type. The Heap type stores comparable elements and allows you to query for the minimal or maximal element quickly.
https://buff.ly/3T2PR7w

Mecid, to random
@Mecid@mastodon.social avatar

Dictionary and Set types that Swift language provides us store values in a single flat hash table that you copy on every write or mutation. TreeDictionary and TreeSet types hold values in the tree-based structure, allowing the efficient updating of only the needed branches.
https://buff.ly/3T2PR7w

Mecid, to random
@Mecid@mastodon.social avatar

It is very easy to create a data race but very hard to fix. So investing time into building a type-safe type in your codebase is much better. Apple provides us with the OSAllocatedUnfairLock type, allowing us to control concurrent access.
https://buff.ly/3Pr8XSO

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