How to use dynamic color in iOS

Issue #792 iOS 13 introduced Dark Mode with User Interface Style that makes it easy to support dark and light theme in our apps. Before we dive in, here are some official resources WWDC 2019 Implementing Dark Mode on iOS Supporting Dark Mode in Your Interface Choosing a Specific Interface Style for Your iOS App Adaptive color Like adaptive layout that adapts to different screen sizes, adaptive colors adapt to different user interface styles, for now they are light and dark mode....

March 13, 2021 路 7 min 路 Khoa Pham

How to use ViewBuilder in SwiftUI

Issue #767 SwiftUI 鈥檚 ViewBuilder is a custom parameter attribute that constructs views from closures. It is available in body and most SwiftUI modifiers public protocol View { associatedtype Body : View @ViewBuilder var body: Self.Body { get } } public func contextMenu<MenuItems>(@ViewBuilder menuItems: () -> MenuItems) -> some View where MenuItems : View In these ViewBuilder enabled places we can perform conditional logic to construct views. For example here in our SampleView, we have switch statement in body...

February 2, 2021 路 3 min 路 Khoa Pham

How to simplify communication patterns with closure in Swift

Issue #744 As someone who builds lots of apps, I try to find quick ways to do things. One of them is to avoid repetitive and cumbersome APIs. That鈥檚 why I built Anchors to make Auto Layout more convenient, Omnia to add missing extensions. The next thing in the itchy list is the many ways to communicate among objects in iOS and macOS development that can be very annoying sometimes....

January 6, 2021 路 11 min 路 Khoa Pham

How to make Auto Layout more convenient in iOS

Issue #742 Auto Layout has been around since macOS 10.7 and iOS 6.0 as a nicer way to do layouts over the old resizing masks. Besides some rare cases when we need to manually specify origins and sizes, Auto Layout is the preferred way to do declarative layouts whether we choose to do UI in code or Storyboard. The Auto Layout APIs have some improvements over the years, there are also some sugar libraries that add easy syntaxes, so more choices for developers....

January 5, 2021 路 18 min 路 Khoa Pham

How to use flexible frame in SwiftUI

Issue #734 In SwiftUI there are fixed frame and flexible frame modifiers. Fixed frame Positions this view within an invisible frame with the specified size. Use this method to specify a fixed size for a view鈥檚 width, height, or both. If you only specify one of the dimensions, the resulting view assumes this view鈥檚 sizing behavior in the other dimension. VStack { Ellipse() .fill(Color.purple) .frame(width: 200, height: 100) Ellipse() ....

January 1, 2021 路 7 min 路 Khoa Pham

My year in review 2020

Issue #715 I remember this time last year in December 2019, I spent almost every single bit of my free time on Puma because I want a Swift friendly version of fastlane that suits my need and leverages Swift 5 features. Here鈥檚 my review of my work in year 2020. Blogging I started blogging on GitHub issue, starting from Issue 1 Hello world, again, now I have over 670 issues, which were generated into blog posts at my website https://onmyway133....

December 16, 2020 路 9 min 路 Khoa Pham

How to test push notifications in simulator and production iOS apps

Issue #682 After has recently reminded about his updating APNs provider API which makes me realised a lot has changed about push notifications, both in terms of client and provider approach. The HTTP/2-based Apple Push Notification service (APNs) provider API lets you take advantage of great features, such as authentication with a JSON Web Token, improved error messaging, and per-notification feedback. If you send push notifications with the legacy binary protocol, we strongly recommend upgrading to the APNs provider API....

October 11, 2020 路 12 min 路 Khoa Pham

Favorite WWDC 2019 sessions

Issue #305 This year I鈥檓 lucky enough to get the ticket to WWDC and I couldn鈥檛 be more satisfied. 5 conference days full of awesomeness, talks, labs and networking, all make WWDC special and memorial conference for every attendee. As predicted by many, Marzipan (now officially called Project Catalyst) a technology that could allow iOS apps to be ported to macOS, would be the main topic for this year. But WWDC went more spectacular than that, with dark mode on iOS, independent watchOS apps, and SwiftUI being the star of the show....

June 12, 2019 路 8 min 路 Khoa Pham

How to add app icons and splash screens to a React Native app in staging and production

Issue #268 React Native was designed to be 鈥渓earn once, write anywhere,鈥 and it is usually used to build cross platform apps for iOS and Android. And for each app that we build, there are times we need to reuse the same code, build and tweak it a bit to make it work for different environments. For example, we might need multiple skins, themes, a free and paid version, or more often different staging and production environments....

May 23, 2019 路 12 min 路 Khoa Pham

Learn iOS best practices by building a simple recipes app

Issue #258 I started iOS development when iOS 7 had been announced. And I have learned a bit, through working, advice from colleagues and the iOS community. In this article, I鈥檇 like to share a lot of good practices by taking the example of a simple recipes app. The source code is at GitHub Recipes. The app is a traditional master detail application that showcases a list of recipes together with their detailed information....

May 23, 2019 路 28 min 路 Khoa Pham