Tired of bloated SwiftUI views?
Learn to craft killer custom ViewModifiers that clean up your code & level up your UI game.
You’ll walk away with 3 you’ll want to use right away.
#SwiftUI #iOSDev #SwiftLang
Tired of bloated SwiftUI views?
Learn to craft killer custom ViewModifiers that clean up your code & level up your UI game.
You’ll walk away with 3 you’ll want to use right away.
#SwiftUI #iOSDev #SwiftLang
I’m adding charts to my spoon management app. Still work in progress.
(No third party lib, no #SwiftCharts, no #SwiftUI)
Here's a first step toward a UI for boolean search expressions for Magic cards.
Baby steps y'all.
#SwiftUI's Color.mix(with:by:in:) makes it easy to increasingly interpolate the current foreground color towards white (or black) while keeping its hue reasonably intact.
I'm working on a #SwiftUI view modifier that calculates a foreground Color that maintains sufficient contrast with the background and also takes the font into account. This can improve #accessibility without too much design-time overhead.
It's using APCA by @Myndex.
We can set a custom background for a window on macOS in #SwiftUI using the containerBackground() modifier. And to extend it to the toolbar, we need to apply toolbarBackgroundVisibility(.hidden, for: .windowToolbar) to the window’s content.
Learn more: https://nilcoalescing.com/blog/CustomizingMacOSWindowBackgroundInSwiftUI/
Heeeelp!
What does the following error mean, and how do I fix it? It happens, when I call `modelContext.save()` in a SwiftUI view.
"SwiftData/ModelCoders.swift:105: Fatal error: Composite Coder only supports Keyed Container”
Edit: Solved! It appears SwiftData does not support Duration properties in models. Changing it to a TimeInterval instead fixes it.
I'm trying to detect the tap location on a #SwiftUI Map.
If I add an onTapGesture, it works
Anyone knows a way to not override this default gesture? I would ideally prefer not having to use an UIViewRepresentable if possible.
Do you have any idea @hishnash @natpanferova @yanlu? Thank you!
Using `EnvironmentValues` To Detect iOS Device is iPad
#ios #SwiftUI , #developers
Today in TIL...
I have been struggling with understanding how to import whatever might be on the clipboard and this bit of code helped immensely.
If you copy an image in Safari via the context menu, there are actually nearly 20 different objects placed on the clipboard.
If this is documented anywhere, I never found it.
With ShareLink there's really no way to know if a user has shared something or even dismissed the share sheet?
SwiftUI supports several scene types on macOS, and they each serve a different role, from managing multiple windows to adding menu bar functionality. I have a post that covers them all, and I often find myself referring back to it for a quick reference: https://nilcoalescing.com/blog/ScenesTypesInASwiftUIMacApp/
#SwiftUI #macOSDev
From @jtr's lovely post:
"Journalley blows this mental challenge away. It invites me to take notes and just notes. It’s the opposite of a chore. “Go ahead,” it winks at me, “spill the beans. Snap some pictures. We’ll work on the details later.” Suddenly, I’m free to let my mind go."
Thought I was clever making a custom drawer component, only to realize that SwiftUI already has a DisclosureGroup component that’s literally the same thing
More progress on my Symbol Browser App.
I am having a memory leak issue on Mac app to work on but otherwise MVP
#Swift #SwiftUI #BuildInPublic
@caseyliss Honestly that is not the problem, but the sheer complexity of the #Swiftlang type system, and it actually being used by #SwiftUI.
When SwiftUI is good its very good.
I was able to add this filter and option button to filter my sidebar list with three different sections. Total time spent perhaps 30 minutes?
Now users can filter the list(s) to quickly find the item they want and they can toggle display of items already contained in groups.
Need to update all my help docs and screenshots but it's worth it.
You can use any view modifiers on any part of the text, as long as it results in a Text for each replacement. This unfortunately won't let you apply background styles (which would have been great for syntax highlighting) since that modifier returns a "some View", but it's pretty decent besides that:
#SwiftUI