Old driver iOS weekly, just for you to present valuable information.

We have opened an official account, which will push messages when each issue is released. Welcome to follow it.

RSS feeds are also supported: github.com/SwiftOldDri… .

You can also contribute to the project, if you find valuable information, articles, tools, etc., please send it to us in Issues, we will deal with it as soon as possible. Be sure to include a reason for your recommendation. Suggestions and comments are also welcome to Issues.

The old Driver’s Choice column

We have launched a paid column on the small column: SwiftOldDriver Selection. The income from the column will be used for the daily operation of the weekly editorial department. The average column was updated one article per week until the end of 2018. Now the subscription price is 49 yuan, the price will return to 59 yuan next week. If you are willing to support us, you are welcome to subscribe and believe that the content will not disappoint you.

IOS Continuous Delivery has five other options besides Fastlane.

news

Allows users to manage data stored in iCloud

To help developers comply with the EU’s upcoming General Data Protection Regulation (GDPR), Apple provides native apis and Web apis for developers to help users export, restrict or delete data from CloudKit. And when users deactivate their Apple ids or restrict their data, developers need to deal with error messages returned by the CloudKit API.

Swift static libraries are now available in CocoaPods 1.5

CocoaPods has been updated to 1.5 this week, mainly to improve support for the Swift static library, adding an option to automatically handle the Module header search path and adding more information to podfile.lock. Those who are maintaining open source libraries are advised to read this Release Note carefully.

The article

🐎 Swift Tip: Capture Lists

Usually we solve the reference loop with [unowned self]. We can also declare the instance we use directly by capturing the list, so that we don’t reference self in the closure:

observation = viewModel.observe(\.navigationTitle, options: [.initial, .new]) { [navigationItem] _, change in
    guard let v = change.newValue else { return }
    navigationItem.title = v
}

Copy the code

🐕 Trace Block argument objects in Objective-C methods

This article presents an innovative solution to monitor whether callback blocks are being executed correctly – BlockTracker. By associating a function with a block argument to a specific Tracker object, you can listen to when all of the function’s block arguments are called, when they are destroyed, and even how many times they are called. In addition to helping us debug problems, it also provides reference for us to analyze some black box functions.

The implementation principle of OC Runtime and the interaction between OC and C are discussed in detail in this paper. (Recommended reading in conjunction with the introduction to BlockTracker’s predecessor: BlockHook).

🐕 Copying of iOS

This paper gives a detailed introduction to Copy in iOS development, explains the concept of shallow Copy and deep Copy, analyzes the Copy and MutableCopy operations of mutable objects and immutable objects, and also gives the method of how to carry out deep Copy and add Copy operation support for custom classes.

🐢 Calling Go code from Swift on iOS and vice versa with Gomobile

This paper introduces in detail the author’s step pit process of calling Go in iOS project, mainly including the following contents:

  • Common errors or unexpected conditions, and solutions for them;
  • How to create a struct instance of Go by calling a Go constructor in Swift;
  • How to define an interface in Go that needs to be implemented by Swift code;
  • Pass the Swift implementation to Go’s constructor and initiate two-way communication.

If you are interested in the iOS application of Go, you can take a look and learn a lot.

🐕 How to achieve the correct line spacing and line height in iOS

LineSpacing in NSAttributedString is not the line acing that designers and we normally understand. To achieve a line acing that matches the design draft exactly, combine lineHeight and lineSpacing. If you want to ensure that the lineSpacing on iOS and various Android devices is exactly the same, you should not use lineSpacing and should use lineHeight and baselineOffset instead.

🐕 Some notes and ideas on JSONDecoder, network requests, generic protocol programming are involved in the Swift project

This article describes in detail how to use JSONDecoder and its internal implementation principle. For those who have not started to use JSONDecoder, it is a good tutorial.

🐎 AppleScript for iOS programmer Productivity

Peak uses AppleScript, Apple’s own scripting language, to improve his productivity, and shares two of his scenarios — “Automating trace query crash flows” and “Refactoring Objective C Code.”

🐎 SnapKit best practices

SnapKit best practices article by Siniang. SnapKit tips to make your code more concise and elegant.

🐢 Common iOS development mistakes

This article summarizes some common iOS development mistakes. Covers a wide range of aspects, involving the program design, development, debugging and testing and other stages. At the same time, it also points out several ways to improve quality, which is worth reading.

🚧 Jailbreak Enable WebView remote debugging globally on iOS

After enabling the Developer function in Safari on both mobile devices and MAC, you can open the WebInspector in Safari on MAC to debug Web pages. From page resources, Dom structure, JS debugging, to the console, you can use WebInspector to view and debug H5 pages inside your App. However, this debugging function is only open to Xcode real machine debugging state of App and Safari system browser, can not view and debug other people’s App web pages, with the help of this jailbreak plug-in, we can do global open WebView remote debugging, there are source links in the article

tool

MerchantKit

The modern iOS in-app purchase management framework greatly simplifies the life of an indie developer, allowing you to track purchased items, retrieve purchases, manage subscription expiration dates, resume purchases, validate purchases, and more. MerchantKit is designed for apps with a range of in-app purchases and is an excellent way to add pro versions to your app, either as a one-time purchase or as a subscription.

code

VisualProgrammingLanguage

This is an interesting open source visual programming library. You can create grammar nodes, connect the input and output of nodes, and generate object code by tapping your finger or Apple Pencil. However, it is only a feasibility proof, the efficiency is very low, if you are interested, you can help the author to improve. (Maybe it will make teaching programming easier and fun in the future.)

The current editor

@No story, @Siniang, @Mmoaay, @Eyrefree, @DamonWong, @Msg, @Zhang Jiafu, @Aidenrao, @Parsifal, @Ye Gucheng

instructions

🚧 indicates the need to climb the wall, and 🌟 indicates the editor’s recommendation

Estimated reading time: 🐎 in a short time (1-10 mins); 🐕 medium (10-20 mins); 🐢 slow (20+ mins)