1. List all simulators Find out all simulators xcrun simctl list Find out active simulator xcrun simctl list | grep Booted You will get the result like: $ xcrun simctl list |grep Booted iPhone 11 (AE8852AB-378E-47FB-BD23-4CF77BFBC6DC) (Booted) Now you can erase the simulator by xcrun simctl erase AE8852AB-378E-47FB-BD23-4CF77BFBC6DC 2. Delete the app from active simulator… Continue reading How to delete an App from command line
Category: iOS
Combine Asynchronous Programming
1 Combine basics Combine is a declarative, reactive framework for processing asynchronous events over time. It aims to solve existing problems, like unifying tools for asynchronous programming, dealing with mutable state and making error handling a starting team player. Combine revolves around three main types: publishers to emit events over time, operators to asynchronously process… Continue reading Combine Asynchronous Programming
Configure Visual Studio Code for Swift development
1. Build sourcekit-lsp https://github.com/apple/sourcekit-lsp#building-sourcekit-lsp $ git clone https://github.com/apple/sourcekit-lsp.git $ swift package update $ swift build  The sourcekit-lsp will be here: /Users/zhihuitang/repo/common/sourcekit-lsp/.build/x86_64-apple-macosx/debug/sourcekit-lsp 2. Configure sourcekit-lsp In the sourcekit-lsp settings, set the Language Server Mode to sourcekit-lsp  Set Server Path: 
LLDB you should know
LLDB is a next generation, high-performance debugger. It is built as a set of reusable components which highly leverage existing libraries in the larger LLVM Project, such as the Clang expression parser and LLVM disassembler. LLDB is the default debugger in Xcode on Mac OS X and supports debugging C, Objective-C and C++ on the… Continue reading LLDB you should know
Xcode instruments
 The two columns worth noting in Instruments are # Persistent and # Transient. The Persistent column keeps a count of the number of objects of each type that currently exist in memory. The Transient column shows the number of objects that have existed but have since been deallocated. Persistent objects are using up memory,… Continue reading Xcode instruments
Views vs. layers
A layer is a simple model class that exposes a number of properties to represents some image-based content. Every UIView is backed by a layer, so you can think of layers as the lower-level behind the scenes class behind your content. A layer is different from a view (with respect to animations) for the following… Continue reading Views vs. layers
Xcode tips and ticks
Faster Testing When using TDD you can work more quickly by running a subset of tests – press ⌃⌥⌘G to re-run only your last test, or ⌘-click several tests to run only them. Opening Xcode If you’re in a folder that has both a workspace and a project, use xed . to open the workspace… Continue reading Xcode tips and ticks
CommentPlus for Swift Func
Usage reference: https://zhihuitang.github.io/2019/01/13/CommentPlus-for-Swift-Func.html Download the Xcode extension from here Unzip and double click the extension CommentPlus.app to install the extension In Xcode, put the cursor on the upper line of func, then select Xcode menu bar: Editor -> CommentGenerator -> Generate Func Comment: 
Intermediate iOS Debugging
1. Stop when exception 1.1 Open Breakpoint navigator (Cmd + 8) 1.2 Add Exception Breakpoint  1.3 Keep default values  1.4 Move breakpoint to User level  2. Edit breakpoint Edit Breakpoint  Add Debugger Command:  We will see the following output: 7.89903245455977 7.890427382096 7.87502883137136 7.87004694731339 or Add Log Message  ScreensFromBottom: @screensFromBottom@… Continue reading Intermediate iOS Debugging
Auto Layout
let view = UIView() view.translatesAutoresizingMaskIntoConstraints = false Interface Builder will automatically set its value to false if the view has constraints defined. But for the views created in code, it defaults to true. UIView has a property called auto resizing mask, but its type is UIView auto resizing. var autoresizingMast: UIViewAutoresizing { get set }… Continue reading Auto Layout