Old driver iOS weekly, just for you to present valuable information.
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.
Small column
From Swift To C++
Mango, a weekly editor from the wechat team, recently released an article. This article is organized in the context of the programming paradigm, tasting and comparing the Swift and C++ languages from the perspective of a client engineer. If you are or will be using both Swift and C++ as mainstream programming languages, then this article is definitely worth reading.
news
IPhone X display module replacement plan for touch issues
Extra! Extra! Apple is offering a free iPhone X display replacement service, following the 218-yuan battery replacement service caused by the “downclocked” incident. As long as your iPhone X is tested to meet the following two problems, Apple will replace the display for you free of charge.
- The display screen or part of the display screen does not respond or intermittently responds to touch operations.
- The display responds even when there is no touch.
In addition, there is only one and a half months left for the 218 yuan battery replacement. If you haven’t changed your battery, you can definitely make your old device look brand-new!
The article
π π Language Server Protocol
Some time ago, the Apple Swift team announced at Swift Forum that they would add support for Language Server Protocol (LSP) for Swift and C series languages (C/C++/ObjC). This is a big plus for Xcode-tormented developers and means more third-party IDE support after this.
Matt’s article explains what LSPS are, how they work, and the potential benefits they can bring.
Swift support for LSPS has not been released yet, but Xcode folks have something to look forward to.
π π Tricks & Treats to make UI testing less
Part1, Part2, Part3
Automated testing, especially UI automated testing, should be “unheard of” for most of the developers in China, aware of such a thing, but basically not much practice. This series of articles systematically discusses best practices for UI automation testing. From how to mark UI elements to how to access them, part 3 also explores a “design pattern” for writing UI tests, called PageObject, to improve the maintainability of UI test code.
π Stephen King’s Advice To Software Developers
Stephen King, author of The Shawshank Redemption. He wrote about his experience in “On Writing.” The learning skills are basically the same, so the author of this article blends King’s experience into a software development example.
- Multiple inputs, multiple outputs
- Multiple input: read the source code,
CodeReview
Blog, books, such as no way to start, can pay more attention toOld driver weekly. - Multiple output: Deliberate practice of the skills you want to master.
- Multiple input: read the source code,
- To avoid distractions
- Schedule your time and do certain things at certain times to be more efficient.
- Find a dedicated space and two hours where you can focus.
- Close the door. Open the door
- Focus on development after completion (closed door), acceptance
CodeReview
Or open source, to absorb more ideas for optimization (open door).
- Focus on development after completion (closed door), acceptance
- Kill what you love
- Every time you optimize, delete the code you are proud of but useless, show off better than fit business.
- Take the time to
- There are no shortcuts, so stick with it (but study technique).
π§ π How to remove duplication from Swift tests with helper functions
Extracting duplicate code for XCTest unit tests is not developer-friendly and can cause the following problems:
- During execution, Xcode’s assertion function stops inside the extract function.
- When multiple unit tests report an error at the same time, you need to expand the error message to learn the details.
In order to solve the above problems, the author cleverly uses the other two input parameters of XCAssert function in Swift, file and line, to pass the file and line number of auxiliary function call, so that Xcode can help you correctly prompt the error message to the auxiliary function call place.
π Keeping your code clean
Writing good handwriting is a great plus for the average person, but writing clean and beautiful code is even more important for us developers. Recruiters often have certain requirements for the code style of candidates. This article shares a few tips on how to write good code, which are worth paying attention to and taking into account in your daily development.
- Lines Of Code (LOC) : Code should be concise enough that functions are the smallest unit Of execution, avoiding long Lines Of Code concentrated on a single function implementation.
- The right indentation: Whether you’re tabbed or whitespace, the right indentation will make your code much cleaner and easier to read.
- Standard naming: While naming is always a problem for programmers, we still need good names to improve the readability of our code.
- Declarations of variables and functions: Make declarations where appropriate and group them by function.
- Code style: Every team should have a code specification to unify the code style of team members.
In addition, the author finally recommends several Lint tools to help automate code specification reviews, such as SonarQube, Tailor, and SwiftLint.
π The String ‘s ABI and utf-8
Recently, Michael Ilseman posted on the Swift community forum String’s ABI and UTF-8 to indicate that changes related to the String ABI have been committed to the Master branch. Specifically, this is a significant change to the underlying implementation (which has no impact at the API level), the most important of which is that native Swift strings will be stored in UTF-8 (in memory) instead of ASCII or UTF-16 depending on the content.
Chinese strings have traditionally been the worst-performing utF-8 scenario (requiring multiple UTF-8 encodings to be rearranged and merged to produce Unicode code points), but thanks to modern CPU improvements, these are no longer an issue.
π’ Result<T> θΏζ― Result<T, E: Error>
Error handling of the API has always been a bad part of Cocoa. In the Swift era, we have better enums that help us unify the encapsulation of Data and Error. If you use Alamofire, you’re probably familiar with its Result
, which only requires swift.error for errors. But many times dealing with this empty protocol is still not the most convenient. Result
is used to specify the Error type, and in most cases you define an enum to enumerate all possible errors (note that the Error is Error and not swift.error). In the article, Meowgod compares the advantages and disadvantages of the two methods in detail.
Of course, it is impossible for the authorities to ignore this deficiency. The related proposal SE-0235: Add Result to the Standard Library has been under discussion this week. I believe the Result will come out soon, let’s wait and see.
π’ KVC/KVO summary
A summary and code examples of KVC/KVO are provided. I believe it will be helpful for students who want to learn more about or use KVC/KVO.
KVC
- Basic principles of key-value Coding
- Accessing object properties
- Accessing collection properties
- Visitor search pattern
KVO
- Registered KVO
- Compatible with KVO
- Register affiliate keys
- Key-value Observing implementation details
π’ Application and control of the Category feature in iOS componentization
Much has been written and discussed about componentization in the industry. However, componentization is actually a relatively large engineering problem, for the team that wants to use and has used componentization for development, for the implementation of many details of componentization, in fact, many articles did not say very clear. This paper mainly focuses on the mechanism of component hierarchical communication decoupling, and lists several common schemes, including Category+NSInvocation and Sid CoverOrigin. For these two relatively unfamiliar schemes, the article also has a certain introduction, and wrote the actual use of the code, which is recommended to interested students can take a look at this article. Finally, THE author always believes that the use of categories needs to be cautious, otherwise it will often bring worse effects. As for which scheme to use, it is up to you to decide. There is no tai-chi here, but different teams will have different opinions about layered communication of components, how to do it, whether to do it, and whether the added code and maintenance costs associated with various scenarios are worth it.
π Void
NSHipster introduces a lot of Nothingness. This article focuses on Void in Swift. The content of the article remains Mattt’s trilogy of writings:
-
The use of Void in the standard library
It describes how the Swift standard library uses Void to avoid conflicts with default init when designing express Value by general.
-
Void Some overlooked details
For example, Void is a non-nominal type, how to compare with each other in the case of expansion, some self-contradictory writing methods, etc.
-
Void in the actual development of seconds
Using the network request as an example, completion(.success()) is subtly changed to completion(.success) using Void.
π Swift Tip: Lightweight Observation
For static view structures and dynamic data, we can use the built-in didSet property observer to observe changes to the data and update the view accordingly. The advantage of this technique is simplicity: there is no need to introduce responsive frameworks, KVO, or anything else. This article demonstrates this with a practical example.
π Swift 5 and ABI stability
The Swift 5 branch has recently been prepared to merge into the trunk, which means that the ABI will not change much until Release and will maintain backward compatibility with the ABI in future releases.
Therefore, we can see that the core team is speeding up the pace to adjust the SIMPLIFIED API of the standard library on the Swift forum recently, including adding Contiguous Collection Protocols to establish the memory layout of array to optimize sorting and other operations. Remove sequence. SubSequence to improve array slicing efficiency and so on.
If you don’t already know about the ABI, check out this article to see how ABI stability affects our daily development.
π’ Introduce Flutter to iOS developers
This article is the translation of the official Guide to Flutter for iOS. IOS knowledge and skills are of great value to Flutter development. If you already have iOS development experience, you can use this article to build applications using Flutter with your existing iOS knowledge.
This article mainly introduces how to use UIView, UIViewController and other common iOS knowledge in Flutter. There are 12 chapters: View, page navigation, Threading and async, Engineering structure/localization/dependencies and Resources, ViewController, Layout, gesture detection and Touch event handling, themes and text, form entry, interaction with hardware/third party services and platforms, database and local storage, notifications.
Designed as a comprehensive introduction to Flutter for iOS developers, this article is also available as a development manual. In addition, the author has translated an introduction to Flutter for Android developers to read.
design
Photopea: advanced image editor
Photopea is a free online alternative to Photoshop that has nearly the same interface and keyboard shortcuts as Photoshop and supports multiple languages. It has more than 1.5 million unique visitors.
tool
Stream, a bag grabber on your phone
The configuration is simple, and there is no need to change the agent
-
Grab HTTP & HTTPS requests and responses from mobile phones for developers and testers to quickly locate online problems.
-
Replay and build requests and debug the server interface efficiently.
-
Hosts can be configured on iOS to facilitate switching between product and test lines and test environments.
-
Integrate some common tools, such as URL Decode/Encode, MD5, Base64, timestamp conversion, etc.
Another lightweight UI real-time debugging tool – Sherlock
This is another tool that supports real-time UI debugging besides Reveal. Although Sherlock is not as powerful as Reveal, it is more lightweight and can be used directly by opening the simulator and Sherlock without any configuration. It also allows you to resize the screen to test how your UI looks on various screens, without having to start various emulators. Sherlock is currently in Beta and only supports iPhone emulators.
SmartBaby
SmartBaby is a productivity tool for Swift developers. It deduces Codable models from JSON and has handy customization features. The models created can be grouped by Project and stored in iCloud’s private database using CloudKit.
Recommended by SmartBaby developer @NixZhu
code
AloeStackView
AloeStackView is a class similar to vertical UITableView. It focuses on making UI implementation very fast, simple, and straightforward. However, some features of UITababieView, such as view loops, are abandoned in favor of a simpler and more secure API.
features
- Allows you to keep strong references to a view and change its properties dynamically, while automatic layout keeps the UI up to date.
- Allows views to be added, removed, hidden, and displayed dynamically, and provides optional animation.
- Includes built-in support for customizable separators between views.
- Provides an extensible API that allows you to add specialized functionality without modifying AloeStackView itself.
- Widely used and reviewed in high-traffic iOS applications.
- A small, easy-to-understand code base (under 500 lines of code) with no external dependencies and easy debugging.
Audio and video
LEARN TALKS AWESOME CONFERENCE AND MEETUP TALK
As the name suggests, LearnTalks is a site for learning how to Talk, for techies. The website includes the speech videos of popular technology conferences in the field of technology, with languages including Swift, Kotlin, Javascript and so on. It is quite a feeling that you can read all the world conferences without going out of the house. Learning technology and learning talk are carried out simultaneously. Recommend attention.
Season 1: Build a Development environment for Flutter
This tutorial provides you with a step-by-step guide to how to configure the Flutter development environment. In addition to this tutorial, the author has written a very detailed text tutorial for those who are sinking into Flutter.
push
-
Beijing – Baidu web disk continues to recruit iOS development: social recruitment, fresh year, internship can be. The project was technically challenging and the team’s technical atmosphere was excellent. Sincerely hope that all the gods come to learn, but also welcome a good computer foundation to learn together. Resume email [email protected], temporarily also welcome micro blog private message @xiaofei 86 chat ~
-
Beijing – Ant Financial wants iOS/ Android/front-end development: responsible for alipay membership and account business line, located in Beijing International Trade, 100 meters from the exit of Jintai Xizhao subway station. Interested students welcome to send your resume to: [email protected]/[email protected] (the same mailbox) or micro blog private message @ Tu Fan er _ MSG to understand the situation.
-
Shanghai Jike: if you know a smart, hardworking, ambitious and ambitious engineer, come and join us! Any references or resumes can be sent directly to Jason (Immediate iOS Leader) at [email protected] or @jasonyuh on Twitter.
-
Since 2016, Qizhi Technology has entered the field of Internet of Things and artificial intelligence through collaborative workflow Mesh of industrial UAV, and successfully provided uav solutions for real estate, construction, surveying and mapping, power inspection and other industries. If you are interested, you can find out about it via private message @Zhuo, who has no story.
-
Shenzhen Toutiao R & D center sincerely invites all iOS masters to do pleasing projects together: If you want to know more information about Shenzhen Toutiao, you can add small T wechat: Tomtan, to discuss technology and feelings can oh ~~~~
-
Beijing Bytedance iOS team continues to recruit: you can send your resume to [email protected], or add me (@aidenrao) on wechat Jingmu1994 to learn more information about the company and the position.
-
Beijing Baidu Education Business Division recruiting iOS development: Baidu Education Business Division, location: Beijing West Erqi. There are baidu Reading, Baidu Library, Baidu Listening and other App products under the department. The team has a strong technical atmosphere. If you are interested, please send your resume to my email: [email protected].
Pay attention to our
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… .
The current editor
@Siniang, @Xiangerxiansen, @DamonWong, @Msg, @Zhang Jiafu, @Aidenrao, @Parsifal, @Aaaron7, @Fang Qiulong, @Kyo, @TOM510230, @Anotheren, @Shuishui, @Looping, @lao Lao Lao Lao Donkey, @Xiaofei 86, @Bangben, @red paper, @smiling and drinking arsenic, @Jimq
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)