How do I discard changes in my working copy that are not in the index? git stash save --keep-index --include-untracked You don't need to include --include-untracked if you don't want to be thorough about it. or drop the stash git stash drop or all unstaged files in current working directory use: git checkout -- .… Continue reading Git tips
Author: Admin
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
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
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: 
Charles Proxy in Android
1. SSL Proxy/Charles + Android trouble https://stackoverflow.com/questions/17823434/ssl-proxy-charles-and-android-trouble/31945622#31945622 2. Enable SSL Proxy for Nougat+ Update your AndroidManifest.xml application section with networkSecurityConfig.xml <application android:name=”AppName” android:icon=”@mipmap/ic_launcher” android:label=”@string/app_name” android:networkSecurityConfig=”@xml/network_security_config”> Add network_security_config.xml file to your xml resource folder app/src/main/res/xml/network_security_config.xml <?xml version="1.0" encoding="utf-8"?> <network-security-config> <base-config> <trust-anchors> <certificates src="system" /> <certificates src="user" /> </trust-anchors> </base-config> <!-- For debug only --> <debug-overrides> <trust-anchors>… Continue reading Charles Proxy in Android
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
Key-Value Observing
Key-value observing is a mechanism that allows objects to be notified of changes to specified properties of other objects. You can use key-value observing with a Swift class, as long as the class inherits from the NSObject class. You can use these two steps to implement key-value observing in Swift. Add the dynamic modifier and… Continue reading Key-Value Observing
How to upload an App with universal framework to AppStore?
Cocoapods is a popular dependencies management tool for iOS development. We notice that in Cocoapods-v1.3, the framework MUST include simulator (x86_64, i386) architectures, otherwise the pod spec lint will fail and the pod cannot be uploaded to Cocoapods server. It shows error as follows: xcodebuild: fatal error: lipo: -remove's specified would result in an empty… Continue reading How to upload an App with universal framework to AppStore?