#iOS

Articles tagged with #iOS.

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

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

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

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

  • iOS学习线路图

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

  • iOS App 启动图

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

  • iOS输出字体信息

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

  • iOS代码结构

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

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

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

  • 生成iOS模拟器Build

    如果上诉两个条件有一个没有完成,就请继续往下看。否则跳到开始部分。