This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Show current path | |
xcode-select -print-path | |
# Switch xcode | |
xcode-select --switch /Applications/XcodeXX.app | |
# Search active xcodebuild path | |
xcrun --find xcodebuild | |
# Show simulator list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object ServiceGenerator { | |
private lateinit var moshi: Moshi | |
private lateinit var retrofit: Retrofit | |
/** | |
* Initialize{@link Moshi}and{@link Retrofit} | |
*/ | |
fun init(context: Context?) { | |
moshi = Moshi.Builder() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#メモリ -Xmx: AndroidStudio起動時 | |
org.gradle.jvmargs=-Xmx3072M -Xmx4096M -XX:MaxPermSize=2048M | |
#並列ビルドモードを有効 | |
org.gradle.parallel=true | |
#必要な部分をビルド | |
org.gradle.configureondemand=true | |
#デーモンプロセスを使う | |
org.gradle.daemon=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Toastの簡易版 | |
* | |
* @param text 表示文字列 | |
* @param duration デフォルト: Toast.LENGTH_LONG | |
* @return {@link Toast} | |
*/ | |
@Suppress("NOTHING_TO_INLINE") | |
inline fun Context.toast(text: CharSequence, duration: Int = Toast.LENGTH_LONG): Toast { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* カスタムActivityの取得 | |
* 取得できない場合はnull | |
*/ | |
val Activity.rootApplication: RootApplication? | |
get() = (application as? RootApplication) | |
/** | |
* 現在フォーカスされているViewを元にKeyboardを非表示にする | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RxSwift | |
import RxCocoa | |
class ViewController: UIViewController { | |
@IBOutlet private weak var bottomConstraint: NSLayoutConstraint! | |
private let disposeBag = DisposeBag() | |
override func viewDidLoad() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// buildTypesに応じたgoogle-services.jsonをapp/.へコピー | |
gradle.taskGraph.beforeTask { Task task -> | |
if (task.name ==~ /process.*GoogleServices/) { | |
applicationVariants.all { variant -> | |
if (task.name ==~ /(?i)process${variant.name}GoogleServices/) { | |
copy { | |
from "src/${variant.name}" | |
into "." | |
include "google-services.json" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBOutlet weak var floatingActionButton: UIView! { | |
didSet { | |
floatingActionButton.layer.cornerRadius = floatingActionButton.width / 2.0 | |
floatingActionButton.layer.shadowOpacity = 0.8 | |
floatingActionButton.layer.shadowOffset = CGSize(width: 2.0, height: 2.0) | |
floatingActionButton.layer.shadowColor = UIColor.darkGray.cgColor | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import Photos | |
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
} | |
private func selectFromLibrary() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
@IBDesignable class UIPaddingTextField: UITextField { | |
// MARK: Properties | |
@IBInspectable var padding: CGPoint = CGPoint(x: 8.0, y: 0.0) | |
// MARK: Internal Methods | |
override func textRect(forBounds bounds: CGRect) -> CGRect { | |
return bounds.insetBy(dx: self.padding.x, dy: self.padding.y) |