In SwiftUI there are two handy abstractions available to you to format dates for your views. Date DateFormatter You can think of Date as the data piece of it giving you information on the current year, month, time, timezone etc. while you can think of DateFormatter as the piece that will give you that dataContinue reading “How to get the current date in SwiftUI for views”
Category Archives: swiftui
How to authenticate Google Requests with Stytch OAuth API
I recently came across this service called Stytch which allows for passwordless authentication solutions after reading about them raising a series B round. As any tech nerd, I’m always interested in these new services popping up. Turns out, you can do OAuth logins! What better way to get familiar with a service than by tryingContinue reading “How to authenticate Google Requests with Stytch OAuth API”
How to create a calendar in SwiftUI with Grid Layout
So I’ve been building this productivity app because well, I’m a nerd and like doing things like that. In my pursuit I had to create a calendar view like the one above so a user can see how many days they’ve consecutively accomplished some task. In my pursuit I didn’t find any pure SwiftUI resourcesContinue reading “How to create a calendar in SwiftUI with Grid Layout”
How to authorize requests to Google Calendar API
Though I use Python here, the flow should generally be the same across all languages and APIs. You don’t have to be a Python or flask expert to understand this post as it’s more about the OAuth2 lifecycle with Google APIs but, I recommend having the docs open on flask and Python to understand someContinue reading “How to authorize requests to Google Calendar API”
Toggle AppStorage values in subviews in SwiftUI (iOS14+, Xcode13+)
Redefine the AppStorage in subviews with UserDefaults and toggle the value directly in subviews to have it reflected in parent views.
How to create a capsule button with text in SwiftUI (Xcode 13.1, iOS 14+, Swift5)
Use the .overlay with a view and the built-in Capsule shape to create a capsule button with text in SwiftUI.
How to detect first time app launch in SwiftUI
You can use @AppStorage in SwiftUI which wraps over UserDefaults to detect whether a user has been onboarded onto your app or not.
How to indicate page index on pagination with TabView in SwiftUI
You can use indexViewStyle and set the display to always to show to users which page they are on within TabView.
How to implement pagination in SwiftUI
Use TabView alongside PageTabViewStyle to implement pagination in SwiftUI.
How to drag views around with DragGesture
You can use a combination of absolute positioning and DragGesture to create a view that can be dragged around by users.