The National Day and Mid-Autumn Festival holiday is about to end, and it’s been a while since my last essay. In recent days, I have been continuing the development process while also expending considerable effort to deal with various bugs and anomalies in iOS 14.
This essay mainly records some of the issues I’ve encountered during this time and discusses the pros and cons of iOS 14, Xcode 12, and SwiftUI 2.0. The logic might be a bit chaotic as I write whatever comes to mind.
Bugs are Really Numerous
In 2020, Apple aimed to make many significant changes at the software architecture level. Big Sur needed to support Arm, SwiftUI aimed to truly achieve multi-platform operation with a single codebase, and iOS 14 underwent the most visible changes in recent years. However, perhaps due to too many and too ambitious goals with limited time, bugs have been incessant and seem endless. Especially with each new version, there are more bugs than before, which is really frustrating.
For example, in iOS 14.2 beta 2, the
sheet delegate does not respond, although there were no issues in all previous versions. In iOS 14.2 beta 2, the timing of View refreshing has subtly changed, leading to unsynchronized refresh in certain special cases. Errors like these continue to increase.
Modifying data in
@FetchRequest does not automatically update the View. Although 14.2 fixed this for List, manual intervention is still needed in other cases.
When adding or removing data in
@FetchRequest, sometimes there are animations, sometimes there are not. The same code behaves differently in different places. These issues did not occur in SwiftUI 1.0.
Running an app on macOS through Catalyst often leads to freezing (system CPU usage is 0, but the app does not respond).
Xcode 12 has various display anomalies. Recently, a bizarre issue occurred where editing
xcdatamodeld files caused a white area to cover the data editing area, forcing me to operate blindly. This issue doesn’t occur with other file types.
Code completion in Xcode 12 is far inferior to Xcode 11, often requiring the deletion of a large amount of unnecessary completion information.
fileImporter cannot be canceled by gestures. If you use gestures, the
sheet repeatedly pops up unless you click the
cancel button in the top right corner.
The Menu (a new SwiftUI control) behaves abnormally when covered by the keyboard. Currently, I can only place the Menu at the top of the screen.
ContextMenu flashes when selected, which is quite uncomfortable.
In SwiftUI 2, automatic keyboard avoidance was a great idea, but it often leads to many layouts being affected by keyboard movement, requiring more work to avoid this issue. A good idea, but counterproductive in practice.
The Debug area in Xcode 12 sometimes disappears and can be brought back with a shortcut key. Also, the Debug Output window on the right side is mysteriously not displayed by default.
The above are some of the particularly annoying bugs I’ve encountered recently. There are too many others to list.
The result of too many bugs is that I have to spend a lot of time determining whether an issue is due to my own implementation errors or system bugs. If it’s a bug, I need to write a lot of feedback for Apple, hoping for a quick fix. The waste of time is tremendous.
To determine the cause, I currently have two versions of Big Sur (latest and penultimate), three versions of Xcode (11.7, 12.01, 12.2 beta 2), two iPhones with different versions (14.2 beta 2, 14.01), and two simulators (14.2, 14.01) installed on my Mac. It’s quite an effort.
However, this is the necessary price to pay for developing under a not yet fully mature architecture at a time of significant change.
After much complaining, let’s talk about the progress and improvements Apple has brought us this year.
Preview has matured significantly, with fewer crashes or preview issues.
Embedding playgrounds in projects is very convenient, especially with Build Active Scheme enabled, allowing direct use of third-party libraries in playgrounds. This provides great convenience for experimentation and testing during development.
StoreKit’s simulation environment is very useful, greatly improving efficiency in developing in-app purchases. It allows the completion and debugging of all payment-related code without submitting the app and setting up pricing. However, I’ve found that restore doesn’t seem to work; I’m not sure if I’m using it wrong or if it’s not provided.
Fullscreen development mode supports placing simulators directly, improving screen utilization and concentration.
SwiftUI lifecycle makes cross-platform development more convenient.
onChange is what I’m most satisfied with in this year’s SwiftUI changes. The timing of code execution in `
onChange` and View update is consistent, ensuring correct response timing.
The new DatePicker on iOS saves display space, making forms more compact. However, the flicker after selection indicates room for further optimization.
Many new controls. I haven’t used many new controls in this development, but more options are beneficial for developers.
The new controls I use most are: toolbar, menu, lazyStack, lazyGrid.
Support for more complex logic in DSL. With
switch now supported, DSL can implement clearer logic processing with less code.
Improved compilation capabilities for complex DSL.
With each new beta version, Catalyst’s support for SwiftUI improves. In the initial versions, AppKit controls were used in place of UIKit controls. In the current beta 9, the display effect is almost indistinguishable from that on iPad. Using SwiftUI + Catalyst to develop Mac apps is increasingly feasible.
Health Notes 2.0 is now in the final stages, with most features completed except for the chart section. I am applying for beta testing through TestFlight. If you are interested in testing, please send me your email.
Health Notes 2.0 requires a device running iOS 14 or above.