How to delete an App from command line

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

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: 

gitsubree usage

Basic commands about subtree git subtree add --prefix=<prefix> <commit> git subtree add --prefix=<prefix> <repository> <ref> git subtree pull --prefix=<prefix> <repository> <ref> git subtree push --prefix=<prefix> <repository> <ref> git subtree merge --prefix=<prefix> <commit> git subtree split --prefix=<prefix> [OPTIONS] [<commit>] 1. Add subtree For example git remote add -f ios git@github.com:zhihuitang/stockholm-rail-ios.git -f: Pull immediately after adding Add… Continue reading gitsubree usage

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