codelaby (@Codelaby) header
codelaby (@Codelaby) profile picture

Welcome to my coding journey! I share SwiftUI programming tips to help others learn and grow. Explore tutorials, code snippets, and more on my blog and Patreon.

Barcelona, España
Joined November 2009
Photo by codelaby (@Codelaby)Photo by codelaby (@Codelaby)Photo by codelaby (@Codelaby)Photo by codelaby (@Codelaby)Photo by codelaby (@Codelaby)Photo by codelaby (@Codelaby)Photo by codelaby (@Codelaby)Photo by codelaby (@Codelaby)Photo by codelaby (@Codelaby)Photo by codelaby (@Codelaby)
🗯️Unleash your inner geek with the Binary Clock Widget, available on the App Store for iPhone and iPad. 🔗 apps.apple.com/us/app/widget…
1
9
7,237
Safe Area vs. Container Margins vs. Custom Safe Container Margins in SwiftUI 🔴🟢🔵 #SwiftUI #iponeDuo #iOS #ipadOS #macOS
3
8
381
Gracias al artículo de Arturo, he creado safeContainerMargins Define márgenes con fallback automático: ideal para las particularidades del iPhone Duo y evita que iPhone, iPad y macOS se queden a 0. xitter.twitterapi.xyz/Codelaby/status/211975…
Si el contenido de tu pantalla tiene que alinearse con el título de navegación, ¿de dónde salen esos 16 puntos de padding? En SwiftUI, el margen del sistema depende del contenedor y de la posición de la vista. En el iPhone Duo, los dos lados pueden necesitar distancias distintas. Desde iOS 27.1, puedes aplicar los márgenes laterales del contenedor con `.contentMargins(for: .container, edges: .horizontal)`. Y si necesitas los valores para un carrusel, `GeometryProxy.contentMargins(for:edges:)` te da los `EdgeInsets`. Ahí encajan las dos APIs llamadas `contentMargins`. La guía `.container` resuelve cuánto espacio corresponde. `.scrollContent`, disponible desde iOS 17, indica dónde aplicarlo. Combinarlas permite alinear la primera tarjeta con el resto de la pantalla y conservar el desplazamiento hasta el borde. Mide cerca de la vista que va a usar el resultado. Si una vista antecesora ya aplicó el margen, la lectura puede dar cero. El área segura se gestiona aparte. Dejo el enlace en el hilo, con ejemplos y un fallback para versiones anteriores de iOS. #SwiftUI #Swift #iOSDevelopment
1
3
225
Ever notice how iOS (iPhone & iPad) sets default container margins to 0, while devices like the iPhone Duo have non-equal margins .safeContainerMargins(.horizontal, 16, for: .scrollContent)
2
8
952
I built a lightweight safeContainerMargins() extension using .onGeometryChange() to intelligently apply a fallback value per axis only when the system gives you 0!
1
89
Building adaptive music layouts with ArrangementView One screen, two arrangements: • Portrait → overlay (lyrics behind player) • Landscape on wide → split (player + lyrics side by side) #iphoneDuo #iosDev #SwiftUI
5
10
544
Views composition:
1
83
I prefer to set it to at least 27.1 and take advantage of the framework's features; iOS users keep their devices updated.
8 SwiftUI APIs and the iOS version each one needs. iOS 14: LazyVStack @StateObject iOS 16: NavigationStack Swift Charts iOS 17: @Observable SwiftData ContentUnavailableView TipKit Your minimum target is a feature list. Set it to iOS 17 and all 8 are yours. Set it to iOS 15 and you lose 6. Xcode stops the build when you call an API newer than your target. #available lets you ship both paths, but you write the feature twice. Open your project's minimum deployment target today. Reply with the one API you are waiting on.
1
513
MD QuickLook: Simple, Easy, Fast Markdown Previews on macOS
1
2
252
I installed from this
1
52
Simple and fast; allows for selection by combining text and code.
MD QuickLook - macOS 原生高速 Markdown Quick Look 预览插件 支持 GFM、代码高亮、公式、深浅色、缩略图,Rust + Swift 实现。 👉 github.com/armamut/md-quickl…
94
Just refactorized EvenColumnsDemo in SwiftUI! 🚀 Cleaned up the layout metrics, integrated geometry observation, and fine-tuned column adaptation with dynamic fold spacing and corner inset margins for flexible form factors. #swiftUI #iosdev #iphoneDuo
2
5
505
Testing a hybrid design to see how it looks in full-screen mode on the iPhoneDuo. #iosdev #buildinpublic #swiftui
3
426
My brain is fried from trying to implement support for customizing toolbars: ipad, mac, iphone and iphoneDuo. #BuildInPublic #iosdev
3
7
607
iphoneDuo all orientations:
97
Recreated natpanferova 's hinge interaction concept with a lotus flower blooming effect 🪷 Built a safe hingeDetector wrapper around onHingeChange to support device fold angles while keeping standard tap & auto-bloom fallbacks for pre-iOS 27.1 devices. #SwiftUI #iOSDev
2
6
612
Iteration after iteration, it’s all starting to come together. #swiftui #UXUI #buildinpublic #iosdev #iPhoneDuo
Inspired by timeline twitter
5
19
1,952
Inspired by timeline twitter
1
2
2,240
I am working on another composition, built using a custom Arrangement View style.
1
7
1,110
The "ArrangementView" on macOS is the worst; I suspect it’s riddled with bugs
119