Archives

All the articles I've archived.

2026 4 posts

April 1 post

  • Refactoring the Neo4J Cache Layer

    Last week was almost entirely firefighting. We use Neo4J as our graph query backend, and to speed things up we had been caching a large volume of relationship data in Redis. The problem: the cache kept growing, and so did the AWS bill.

March 1 post

  • 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.

January 2 posts

  • 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.

2025 14 posts

December 2 posts

November 5 posts

  • 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 来逃避。

September 1 post

  • 一段有趣的代码之 swift 6 对于内存访问优化

    早上躺在床上挣扎起床, 拿起手机刷完邮件, 和工作IM之后忍不住打开了X. 看到一个tweet https://x.com/Lakr233/status/1972677999729512858. 看了下, 随口说出了答案是200. 但是 @Lakr233 说他这个问题另有深意. 所以赶紧起床研究问题.

August 5 posts

  • confetti animation

    This post is about creating a confetti animation in SwiftUI with a customizable duration. I learned the technique from this Patreon tutorial.

  • Take On / Off Light Animation

    Sometimes, you have to explore different paths to find where you truly belong. For a developer, that path is often paved with different languages, frameworks, and platforms. My own journey has taken me through the worlds of backend development, cross-platform apps with React Native and Flutter, and of course, native iOS. And after seeing what each has to offer, I’ve come to a clear and exciting realization: my true passion lies in building for native iOS.

  • binding-with-casepath

    While the standard property wrappers handle most state management needs, you will often encounter situations where the shape of your state doesn’t perfectly match the requirements of a SwiftUI view. For example, a view might need a Binding<String>, but your model provides a Binding<String?>. Or a view needs to bind to the associated value of an enum case.

  • swiftui-state-management

    In SwiftUI, managing the state of your application—the data that drives your UI—is a fundamental concept. SwiftUI provides a set of powerful property wrappers that handle view updates automatically when your data changes. This guide explores the core tools: @State, @StateObject, @ObservedObject, and @Published.

  • Minimalist Swift 6 Tutorial

    I am ready to systematically review the iOS knowledge, so I have this simple Swift 6 Programming study notes.

April 1 post

  • prepare-det

    Today I start to prepare Duolingo English Test. I made honey sweet potato chips for the children today, and the children loved it.

2023 1 post

July 1 post

  • Modern Vim: Tips and Techniques for Efficient Editing

    Vim is a powerful and versatile text editor that offers a wide range of features and customization options. In this article, we will explore some useful tips and techniques from the book “Modern Vim” to help you become more efficient and productive in your Vim editing.

2018 1 post

October 1 post

  • 入门(keystone文档翻译)

    Keystone是一个强大的Node.js内容管理系统,它是建立在Express和Mongoose ODM上的Web App框架。Mongoose ODM是面向文档映射,为那些存储到MongoDB数据库中文档,其提供了面向基于模式的解决方案来为数据和关系建模。Keystone扩展了Mongoose基于模式模型。Keystone列表利用智能字段类型帮助你构建漂亮的Admin界面。

2017 3 posts

March 3 posts

  • 04.Keyboard Row

    给定一组单词,返回所有字母都在同一行美国键盘上的单词。

  • 03.Number Complement

    给定一个正数,输出它的“补数”。求的方法是把二进制位置的数进行取反。

  • 02.Hamming Distance

    给定两个数字,求这两个数的二进制数相应位不同的总数。

2016 1 post

November 1 post

  • Two Sum

    给定一组数和一个目标值,求出两个加数的位置。

2015 6 posts

August 1 post

  • 也谈谈MVVM(一)

    从学习iOS开发就开始接触到MVC的开发模式了。随着越来越注重用户体验以及业务越来越复杂。ViewController也越来越臃肿,同时我们的工作量也越来越大。在ViewController中混杂着业务逻辑与UI处理的逻辑。完整的测试ViewController既要对UI进行测试也需要对业务逻辑进行测试。测试起来比较麻烦。

June 1 post

  • iOS学习线路图

    我们公司在南京招聘iOS的时候,人真难找啊。而我也一直有想开设一个培训班的想法。乘着现在不想写代码。写一篇iOS学习路线图的文章。同时也决定出一系列的学习教程。

April 1 post

  • iOS App 启动图

    iOS App在打开的时候一般会显示一张启动图片。这样用户会觉得程序打开速度和响应速度很快。启动图片只有一个用途就是让用户觉得程序响应很快,除此之外没有其他作用。

February 1 post

  • 阅读书籍

    常常想把自己看的书记录下来,一直想下一次记,然后就没有然后了。现在先记下来再读吧。:D

January 2 posts

  • 如何生成pem证书

    登录到 iPhone Developer Connection Portal(http://developer.apple.com/iphone/manage/overview/index.action )并点击 App IDs

  • iOS输出字体信息

    for(NSString *familyName in [UIFont familyNames]){ NSLog(@"Font FamilyName = %@",familyName); //*输出字体族科名字 for(NSString *fontName in [UIFont fontNamesForFamilyName:familyName]){ NSLog(@"\t%@",fontName); //*输出字体族科下字样名字 } }

2014 6 posts

December 3 posts

  • Swift 闭包(Closure)

    最近想开始折腾Swift了。所以整理整理学习笔记。不得不说Swift确实比Objective-C简洁啊。在OC中Closure已经用的比较多了,每次声明的时候都是长长一串。现在终于不用那么麻烦了。不废话了,先来看看Closure的语法吧。

  • iOS代码结构

    从学习iOS以来虽然经常思考如何组织代码,但是却很少总结。进来看到一篇文章,觉得之前觉得朦朦胧胧的地方突然豁朗开朗。所以决定也来写一写iOS代码结构的总结。

  • iOS中带有Alpha Chanel的视频叠加

    最近一个项目中,需要将一些视频特效(下雨,下雪,烟花)合成到另一个录制好的视频中去。于是一头扎进AVFoundation中寻找实现方法。很遗憾AVFoundation中没有找到简单的方法来实现我要求的效果。如果你尝试通过AVMutableComposition来尝试添加一个AVAssetTrack的话,你会发现带有Alpha通道的视频播放的时候背景是黑色的——并不是透明的。于是开始尝试将黑色背景编程透明的。找了很多资料都没有得到将黑色背景变成透明的方法。浪费很多时间之后不得不尝试其他途径来实现这个需求。

November 2 posts

October 1 post

  • 清理git信息

    git信息是根据文件夹里面的 .git文件夹保存相关配置的,删除此文件夹即可去掉git信息:

2010 1 post

December 1 post

  • Hello World

    Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.