Old Driver iOS Weekly #242 | 2023-04-24

Original link: https://github.com/SwiftOldDriver/iOS-Weekly/releases/tag/%23242

ios-weekly

The old driver’s 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 them to us in Issues , and we will deal with them as soon as possible. Remember to write down the reason for the recommendation. Suggestions and comments are also welcome to Issues .

news

Enabling the Inspection of Web Content in Apps

WKWebView and JSContext have added the attribute isInspectable in the iOS 16.4 SDK. Only when this attribute is turned on can the elements of the web be inspected, and this attribute can be modified at any time (no need to restart the APP or recreate the Webview instance). For students who need to debug Webview, they need to adapt (enable) this property before viewing it through Web Inspector as usual.

 Developer – design and development accelerator

Challenge: Make Your App More AccessibleMay 10, 2023

In this webinar, you’ll learn how to create a great user experience for everyone with the accessibility features, accessibility APIs, and developer tools provided by Apple’s operating systems.

The development team participating in the online lecture can sign up to participate in the barrier-free adaptation challenge on the day of the lecture. After passing the review, we will invite you to participate in the offline event of the Accessibility Awareness Day held at the Shanghai Design and Development Accelerator on May 18, online Next, you will learn more about accessibility development techniques, and communicate and interact with other developers. We will also invite users who use accessibility features to share their stories and understand how App empowers their daily life; and experienced developers to share their engineering practices to see how to promote accessibility adaptation within the product . You can also get one-on-one consultation and in-depth coaching, and get suggestions for optimizing the accessibility of your App.

Webinar: Exploring the Vision Framework

The Vision framework supports a series of capabilities such as face detection, text detection, QR code detection, image registration, and feature tracking. Explore how to apply computer vision-related capabilities in your App through the Vision framework, and learn about a series of APIs to perform different tasks on images and videos.

article

Douyin Swift compilation optimization – 60% faster compilation based on custom Toolchain

@kemchenj : The Douyin basic technology team shared a very interesting compilation problem in this article:

  1. In a mixed module of Swift and OC, all directly and indirectly dependent modules will be imported in the xxxx-Swift.h file automatically generated by Swift. (This behavior is also known as re-export)
  2. So for an OC module that depends on this mixed-code module, all its indirect dependencies will become direct dependencies.
  3. For the compiler, when the module API that a module directly depends on changes, its compilation cache will become invalid and it needs to be recompiled.

Due to the above three points, the API modification of the underlying library can easily trigger large-scale compilation cache invalidation, and because the direct dependencies of the upper-level modules increase, the judgment logic for cache invalidation will become more complicated, which will eventually lead to an increase in compilation time.

The reason why Swift is designed this way is mainly to be compatible with the behavior of C/OC header files . The development team has also explained the specific details in the Swift forum .

But the actual code seldom relies on this behavior. Douyin’s technical team tried to customize the Toolchain, adding more options to limit the effective range of this behavior, and finally achieved a 60% increase in compilation speed .

Principle of PC GWP-ASan solution | Heap damage troubleshooting practice

@xuyafei86 : It is well known that memory access related crashes are one of the most difficult types of crashes to analyze. For this kind of crash, the crash logs collected online can provide very limited effective information. Because the time of heap corruption is often long before the crash occurs, when the crash occurs, the context has already been lost, and it is very challenging to trace the source of the heap corruption from the crash location.

GWP-ASan is a debugging tool developed by Google to detect heap memory problems. It is based on the classic Electric Fence Malloc debugger principle, probabilistically samples memory allocation behavior, catches memory problems and generates upload crash reports. It can detect errors related to memory access such as Use-after-free, Buffer-overflow and free-invalid-address.

This article introduces the practice of Jianying Professional Edition accessing Byte’s internal APM-PC platform GWP-ASan function, including a description of the monitoring principle and 5 online examples. Interested students can read the original text to understand.

? What I Learned Writing My Own CloudKit Syncing Library

@Smallfly : CloudSyncSession is a Swift library based on the CloudKit framework, designed to make it easier to write applications that support sync and offline functionality. The author introduces the development background, design ideas, and usage posture of the library through an article.

? Mastering Canvas in SwiftUI

@那尔先森: In SwiftUI, you can use advanced ShapAPI to draw graphics, or you can use Canvas to draw directly. This article introduces the basic usage of Canvas , and also introduces how to use Canvas to draw text, pictures, and even add animation to Canvas .

? 3 mistakes to avoid with async / await

@Cooper Chen : The author of this article uses async/await in Swift to avoid 3 mistakes, including:

  • Run code as differently as possible
  • Can’t correctly understand the principle of Task automatically capturing self
  • Used Task.detached when not needed

? Exploration and Realization of Taobao iOS Polaroid Macro Capability

@EyreFree : On the iPhone13 Pro Max and iPhone14 Pro Max series mobile phones released by Apple in the past two years, if you use three-party mainstream apps for close-range focusing, the picture will be blurred. In order to optimize the user experience, the Pailitao iOS development team analyzed and solved the problem of camera switching (macro). This article starts with the analysis of the principle, and divides the proposition of “macro distance realization” into three main solution goals through layer-by-layer dismantling: zoom coefficient, illumination level, and determination of focus position. And the feasibility verification is carried out around the three levels of link realization, performance, and adaptation, and the implementation of the macro capability is completed. It is recommended that students who are studying related issues read it.

? Using DWARF to find call sites of inline functions

@Damien : DWARF is a debug information file format used by many compilers and debuggers to support source-level debugging. It addresses the requirements of some procedural languages, such as C, C++, and Fortran, and is designed to be extensible to other languages. DWARF is architecture independent and works on any processor or operating system. If you need to use DWARF to find the call sites of inline functions, you may wish to read this article, which may be of great help to you.

? Reducing iOS app size using linker and why_load

@Leo : why_load is a link option provided by Apple LD. Through this option, we can understand why a Symbol is retained when the link forms the final product. The article describes how to use this option to reduce the reserved symbols in our App Extension product, thereby optimizing the package size. Of course, a similar method can also be used for the main binary, but the optimization of the main binary should be more cautious to avoid introducing new problems.

Moyu Weekly

@探鱼周报#91 : The 91st issue of Moyu Weekly, let’s take a look at the summary of this issue:

  • Topic of this issue: Webinar: Exploring the Vision Framework; On May 9th, App Store pricing will be updated based on US prices
  • Content recommendation: recommend some recent excellent blog posts, covering: App Clip, CloudKit, Swift ABI stability, etc.
  • Touch the fish: build a community for exchanging AGI knowledge; deploy ChatGPT chat ability on Vercel; a website that anthropomorphizes AI; AI Talk allows Musk and Jobs to have a conversation based on GPT4; an app based on Apple’s health data analysis HealthGPT
  • Job Recruitment: NIO App iOS R&D

Introduce

Restarted to update the “iOS Reliable Internal Recommendation Topic”, and sorted out the positions that have been clearly recruited recently for your reference

For specific information, please go to: https://www.yuque.com/ioalliance/article/bhutav to view (if you have any recruitment needs, please contact iTDriverr)

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 politely, pay attention to [Old Driver Technology Weekly], reply to “2021”, and receive 2017/2018/2019/2020 internal reference

It also supports RSS feeds: https://github.com/SwiftOldDriver/iOS-Weekly/releases.atom .

illustrate

? Indicates that a tool is needed, ? indicates an editor’s recommendation

Estimated reading time: ? Can be read quickly (1 – 10 mins); ? Moderate (10 – 20 mins); ? Slow (20+ mins)

This article is transferred from: https://github.com/SwiftOldDriver/iOS-Weekly/releases/tag/%23242
This site is only for collection, and the copyright belongs to the original author.