How I Improved CoreText Rendering to 60 FPS

Recently, I started building a video player that uses CoreText to render subtitles. However, when scrolling through the UI, the frame rate dropped to an unacceptable 15 FPS. To fix this, I created a demo that wraps a native text view with CoreText rendering, eventually optimizing the performance to a smooth 60 FPS.

阅读全文 »

Swift Concurrency - From GCD to Structured Concurrency

I remember when I first graduated and started iOS game development, I used NSThread directly for multithreading. When GCD (Grand Central Dispatch) was introduced, it was very convenient to use, and I used it almost exclusively. occasionally, when tasks had dependencies, I would use NSOperation.

阅读全文 »

ios serious 01

I hadn’t noticed loadViewIfNeeded before. Usually I just access vc.view to force the view to load. loadViewIfNeeded is definitely clearer and more explicit—it avoids accidental side-effects when you only want to load the view conditionally.

阅读全文 »

SwiftUI’s Unexpected Behaviours - A Case Study on Padding and Backgrounds

Many developers complain about SwiftUI because some of its behaviours feel counter-intuitive. For example, in the code at #1, if you comment out the .padding() modifier, the entire area above the search field turns red. That happens because the background of the search view bleeds into its parent container. If you don’t want the Search view’s background to affect the parent view, you have to break that view hierarchy connection.

阅读全文 »

obtain the scrollView's offset

Before iOS 16, you could get the ScrollView’s offset using the following code. However, if the UI becomes complex, the scrollViewOffset will not update while scrolling.

阅读全文 »

How to hide `tabbar` in iOS 18?

I wrapped my view in a NavigationStack and used .toolbarVisibility(.hidden, for: .tabBar) to navigate while hiding the tab bar. However, this causes an issue: the transition animation becomes stiff and unnatural. I haven’t found a good solution yet.

阅读全文 »

上一次认真思考“如何学习”这件事,还是在看 Scott 那本书的时候。他一年之内自学完了四年制大学的 CS 课程。最近我又开始有点迷茫。快四十了,后端不算真正精通,iOS 技能也荒废了,语言也没学好。这些问题叠在一起,让我压力很大。结果又开始玩 Dota 2 来逃避。

阅读全文 »
0%