A. 直前(1世代前)のコミットを書き換える
1. 編集する(修正する)
1 |
$ vim <file> |
2. 修正をステージングする
1 |
$ git add <file> |
3. コミットする(修正した内容でコミットをやり直す)
1 |
$ git commit --amend |
1 |
$ vim <file> |
1 |
$ git add <file> |
1 |
$ git commit --amend |
Swiftの型(Type)に定義したアクセス修飾子(Access Control Level)は、その型のメンバー(プロパティやメソッド、イニシャライザーなど)に影響する。
例えば、private修飾したclassのメンバーの暗黙的(デフォルト)アクセス制限はprivateである。
1 2 3 4 5 6 |
public class SomePublicClass { public var somePublicProperty = 0 // 明示的publicクラスメンバー var someInternalProperty = 0 // 暗黙的internalクラスメンバー fileprivate func someFilePrivateMethod() {} // 明示的file-privateクラスメンバー private func somePrivateMethod() {} // 明示的privateクラスメンバー } |
public typeはデフォルトでinternalのメンバーを持つ。publicではない。メンバーのアクセス制御をpublicにするときは、いかなるケースでも明示的にpublic修飾を記述する必要がある。
1 2 3 4 5 |
class SomeInternalClass { var someInternalProperty = 0 // 暗黙的internalクラスメンバー fileprivate func someFilePrivateMethod() {} // 明示的file-privateクラスメンバー private func somePrivateMethod() {} // 明示的privateクラスメンバー } |
型(クラス)のデフォルトアクセスコントロールはinternal。したがって、その型(クラス)のメンバーのデフォルトアクセス制御もinternalとなる。
1 2 3 4 |
fileprivate class SomeFilePrivateClass { func someFilePrivateMethod() {} // 暗黙的file-privateクラスメンバー private func somePrivateMethod() {} // 明示的privateクラスメンバー } |
明示的にクラスにfileprivateを指定しているため、そのクラスのメンバーのアクセス制御もデフォルトではfile-privateとなる。もちろん明示的にprivateを指定したメンバーはprivateになる。
1 2 3 |
private class SomePrivateClass { func somePrivateMethod() {} // 暗黙的privateクラスメンバー } |
1 |
Result of call to 'xxx' is unused |
使用しない(無視する)関数の戻り値はワイルドカード(_)に明示的に代入する。
1 |
_ = fooFunc(3) |
iOS 8以降に搭載されたQuickType(予測変換)
続きを読む
PowerPointのタイトル(文字列)が全て大文字で表される。
文字枠(プレースホルダー)のフォント設定で「全て大文字」が有効になっている。
Sierra (macOS 10.12) でhomebrewがバージョンアップできない。
1 2 3 4 5 |
$ brew upgrade Warning: You are using OS X 10.12. We do not provide support for this pre-release version. You may encounter build failures or other breakages. Please create pull-requests instead of filing issues. |
引数の最後においたクロージャ式は特別な記法で記述できる。接尾クロージャ、後置クロージャ。
1 2 3 |
func someFunctionThatTakesAClosure(closure: () -> Void) { // function body goes here } |
1 2 3 |
someFunctionThatTakesAClosure(closure: { // closure's body goes here }) |
1 2 3 |
someFunctionThatTakesAClosure() { // trailing closure's body goes here } |
1 2 3 |
someFunctionThatTakesAClosure { // trailing closure's body goes here } |
1 2 3 4 5 |
To run dex in process, the Gradle daemon needs a larger heap. It currently has 1024 MB. For faster builds, increase the maximum heap size for the Gradle daemon to at least 1536 MB. To do this set org.gradle.jvmargs=-Xmx1536M in the project gradle.properties. For more information see https://docs.gradle.org/current/userguide/build_environment.html |
APKの作成中に下記のエラーで停止する。
1 2 |
Error:Execution failed for task ':transformResourcesWithMergeJavaResForDebug'. > com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE |