Original link: https://github.com/SwiftOldDriver/iOS-Weekly/releases/tag/%23220
The old driver iOS weekly report, only presents valuable information for you.
You can also contribute to this project. If you find valuable information, articles, tools, etc., you can submit it to us in Issues , and we will deal with it as soon as possible. Remember to write the reason for your recommendation. Suggestions and comments are also welcome to Issues .
article
? A Possible Vision for Macros in Swift
@kemchenj : Some time ago, the Swift team decided to change the compiler’s Parser to use Swift, and built this part of the function into SwiftSyntax.
This means that Swift has become a first-class citizen of the syntax API , we can easily access and modify ourselves (source code) in Swift code, and further, we can write code through code.
If this feature is integrated into the compiler and syntax, it becomes what we know as a macro . Taking this opportunity, the Swift team thought about how to use this API to provide macro implementation in the future, and shared the preliminary design ideas in the forum, hoping that everyone can participate in the discussion.
In the past, many functions hard-coded in the compiler can be implemented through the macro system, such as automatic synthesis of Equatable
/ Hashable
, etc.:
extension Equatable { macro func == ( lhs : Self , rhs : Self ) -> Bool }
? Which Collection?
@Smalfly : Collections are commonly used types in programming languages. Swift collections are value types. For complex collection data, frequent copying may cause performance problems. This article introduces how to optimize the array through a Sudoku algorithm, mainly using the some
keyword to cooperate with the Swift 5.7 protocol to support the new feature of associated types. For more information, please refer to SE-0346 .
? Some pitfalls of using SPM and Build Configuration in Xcode
@Red Paper : After related tests of Meow God, it is found that when compiling a package using SPM in Xcode, it will refer to the name of the Build Configuration and automatically choose to use DEBUG or RELEASE mode to compile, which will lead to a series of factors such as compilation macros and compilation configurations. Affect the final binary product.
Rules: If the name contains Debug or Development (case-insensitive), select DEBUG mode, otherwise, select RELEASE mode.
? iOS Smart Island Development Practice
@anotheren : Smart Island is Apple’s next-generation interactive experience for the iPhone 14 Pro series. In iOS 16.1, the related API has been opened to developers, and only the SwiftUI version of the interface is provided. From the perspective of e-commerce, this article brings an introduction to the development of Smart Island. However, not all features are suitable for display on the Smart Island. It is recommended to check the Live Activities section of Apple’s Human-Computer Interaction Design Guidelines.
? Swift Concurrency – Things They Don’t Tell You
@Cooper Chen : Swift Concurrency provides a very nice way to write asynchronous code, while it is also advertised as safe to use. Unfortunately Swift Concurrency programming has many pitfalls, and the compiler doesn’t check everything
- If using the async keyword, make sure to call it on a background thread, otherwise you need to add the @mainactor attribute
- Swift Actors are not guaranteed to avoid data races during use, and there is no guarantee that an async method will be fully processed before calling another method
- Avoid mixing classic synchronization methods like locks and semaphores with Swift Concurrency
- Set Task priority to avoid dispatching everything on a single queue
- Avoid heavy synchronization work in Task, for example when heavy work like image processing is required, use custom DispatchQueue
- Use await Task.yield() if necessary to allow more frequent task switching
code
Smart Island development sample code
@anotheren : This is a sample code developed by Smart Island, which includes the display of multiple instances. You can eat it together with the above Smart Island development practice.
Audio and video
Swift Video Tutorial ChaoCode
@EyreFree : ChaoCode , a Swift video tutorial, is available from YouTube to Station B, ranging from basic Swift syntax to intermediate Swift content, SwiftUI, and making complete apps in Swift. It is more suitable for getting started with Swift. Interested friends can follow.
Recommended by KeithBird
Moyu Weekly
@Moyu Weekly #72 : The 72nd issue of Moyu Weekly is here, let’s take a look at the summary of this issue:
- Topic in this issue: The 1024 Programmer’s Day has begun to warm up on various technical websites, and there are many prizes to be won; App Store is now open for iOS 16.1 and iPadOS 16.1 App submission
- This week’s learning: When setting the
UIImageView
highlight, the current animation will be paused; the solution for Xcode 14 compiled package crashing on devices below iOS 12.2 - Content recommendation: There are a lot of ways to play in Smart Island to be explored, and some related articles are recommended in this issue.
- Touch the fish: CleverToolKit: iOS developer assistance tool, the page is simple, the size is small. Currently contains json2model functionality.
Follow us
We are “Old Driver Technology Weekly”, a technical public account that continues to pursue high-quality iOS content. Welcome to pay attention.
Follow Youli, pay attention to [Old Driver Technology Weekly], reply to “2021”, and receive 2017/2018/2019/2020 internal reference
Also supports RSS feeds: https://github.com/SwiftOldDriver/iOS-Weekly/releases.atom .
illustrate
? means a tool is needed, ? means editor’s recommendation
Estimated reading time: ? Read quickly (1 – 10 mins); ? Moderate (10 – 20 mins); ? Slow (20+ mins)
This article is reprinted from: https://github.com/SwiftOldDriver/iOS-Weekly/releases/tag/%23220
This site is for inclusion only, and the copyright belongs to the original author.