Paul Young-Suk Lee
I’m a nerd that likes to write and teach code. Working @lyft as a Software Engineer. Likes include too much yak shaving, too much coffee, and 8 hours of sleep.
How to create a multi-line text field in SwiftUI? (Xcode 13.4.1, Swift5)
Use TextEditor in SwiftUI to create something like a multi-line text field in your apps! Handy functionality courtesy of Apple. 🙂Keep reading
How to pretty print a dictionary in Python within a terminal?
There’s a built-in module in Python called pprint it allows you to “pretty print” data structures in Python. To use it import the module, and wrap anything you want to print with pprint instead of print. Remember to force width if you have a dictionary that fits on a single line. From the docs Single…Keep reading
GraphQL advantage: a single endpoint for all the data
I haven’t used much of GraphQL but it seems like the main selling point is that as a client you can just query one endpoint, instead of multiple with traditional REST API’s. There’s probably much give and take here, given that it might relieve clients from having to wrangle endpoints to get their data but…Keep reading
Why I love to use Sourcegraph for my own projects
At my current place of employment, Lyft, we use Sourcegraph which is an open source tool that allows you to search across many, many repos at once. It’s basically Google for any and all code. I also use Sourcegraph on my own projects to search across my own projects or ramp up on open source…Keep reading
How to get the current date in SwiftUI for views
In SwiftUI there are two handy abstractions available to you to format dates for your views. DateDateFormatter 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 data in…Keep reading
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 trying…Keep reading
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 resources…Keep reading
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 some…Keep reading
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.Keep reading
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.Keep reading
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.Keep reading
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.Keep reading
How to implement pagination in SwiftUI
Use TabView alongside PageTabViewStyle to implement pagination in SwiftUI.Keep reading
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.Keep reading
How to deactivate (disable) buttons in SwiftUI
Use the .disabled modifier on views to deactivate any elements with a boolean value set to true.Keep reading
How to detect tap gestures in SwiftUI
Use the handy onTapGesture method to recognize taps on views.Keep reading
How to detect a dragging motion with DragGesture in SwiftUI
Use the DragGesture struct within a .gesture modifier to detect any type of dragging motion alongside the methods of .onChanged and .onEnded with the DragGesture.Keep reading
How to make views disappear in SwiftUI with DispatchQueue
You can make views disappear after some delay by utilizing the DispatchQueue to schedule async work after some amount of time which toggles a boolean value to make a view appear or disappear.Keep reading
How to set the size of SF Symbols in SwiftUI?
Because SF Symbols are similar to fonts you can set the size directly with the .font modifier and passing in a size.Keep reading
How to present a modal view with Sheet in SwiftUI
A modal view is known as a Sheet in SwiftUI. You can use the method on views to open up a sheet on top of the view it’s attached on by passing in a boolean variable binding, optionally a closure to run when dismissed and the view to show in the modal.Keep reading
How to use Picker in SwiftUI?
Using the Picker struct you can build out your own view to let users select from a set of items by passing in a label, variable to bind the selection, and the data and views to compute from e.g. content.Keep reading
How to rotate views in SwiftUI?
You can rotate views by some number of degrees using the .rotationEffect method.Keep reading
How to create a Button in SwiftUI?
You can use the built-in Button struct to create tappable buttons in SwiftUI. Each Button takes in an action to fire e.g. printing to the console, and a View to render for the button (like a Text() field!).Keep reading
How to detect finger drags with SwiftUI
You can detect a dragging motion in SwiftUI with DragGesture and passing it into the .gesture modifier.Keep reading
How to animate Views in SwiftUI?
SwiftUI comes with an .animation modifier that can be applied to any View that conforms to the Animatable property. This includes all Shape like Circle. You can use it by applying the .animation modifier to any of these views with the default being an ease in/ease out animation.Keep reading