This file contains 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
extension UIWindow { | |
open override func motionEnded(_ motion: UIEventSubtype, with event: UIEvent?) { | |
super.motionEnded(motion, with: event) | |
guard motion == .motionShake else { return } | |
let version = Bundle.main.versionNumber ?? "" | |
let build = Bundle.main.buildNumber ?? "" |
This file contains 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
{% for struct in types.all.implementing.Codable|struct %} | |
{% ifnot struct.annotations.ignore %} | |
extension {{ struct.name }} { | |
enum CodingKeys: String, CodingKey { | |
{% for var in struct.storedVariables %} | |
{% if var.annotations.key %} | |
case {{ var.name }} = "{{ var.annotations.key }}" | |
{% endif %} | |
{% ifnot var.annotations.key %} |
This file contains 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 Foundation | |
// MARK: - Localisation | |
struct Localised { | |
{% for enum in types.implementing.Localisable %} | |
struct {{ enum.name|replace:"SourceryLocaliser.",""|replace:".","_" }} { | |
{% for case in enum.cases %} | |
static var {{ case.name }}: String { return NSLocalizedString("{{ enum.name|replace:"SourceryLocaliser.",""}}.{{case.name|capitalize}}", comment: "") } |
This file contains 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 Foundation | |
// MARK: - Localisation | |
struct Localised { | |
{% for enum in types.implementing.Localisable %} | |
struct {{ enum.name|replace:"SourceryLocaliser.",""|replace:".","_" }} { | |
{% for case in enum.cases %} | |
static var {{ case.name }}: String { return NSLocalizedString("{{ enum.name|replace:"SourceryLocaliser.",""}}.{{case.name|capitalize}}", comment: "") } |
This file contains 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
$PODS_ROOT/Sourcery/bin/sourcery --sources ./YourProjectName --templates ./Templates --output ./GeneratedCode/SourceryGenerated.swift |
This file contains 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
apply plugin: 'com.android.application' | |
apply plugin: 'kotlin-android' | |
apply plugin: 'kotlin-android-extensions' | |
android { | |
compileSdkVersion(compileSdk) | |
buildToolsVersion(buildTools) | |
defaultConfig { | |
minSdkVersion(minSdk) | |
targetSdkVersion(targetSdk) |
This file contains 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
// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
// This is the project gradle file | |
buildscript { | |
ext.kotlin_version = '1.2.10' | |
repositories { | |
google() | |
jcenter() | |
} | |
dependencies { |
This file contains 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
ext.internalProject = { code -> | |
dependencies { | |
implementation project(":$code") | |
} | |
} | |
ext.exposedProject = { code -> | |
dependencies { | |
api project(":$code") | |
} |
This file contains 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 android.animation.Animator | |
import android.animation.ValueAnimator | |
import android.content.Context | |
import android.graphics.Canvas | |
import android.graphics.Color | |
import android.graphics.Paint | |
import android.graphics.RectF | |
import android.support.annotation.ColorRes | |
import android.util.AttributeSet | |
import android.util.TypedValue |
This file contains 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 ActivityIndicatorView: UIView { | |
enum AnimationStyle { | |
case linear, extendable | |
} | |
@IBInspectable var trackColor: UIColor = .clear { didSet { setNeedsDisplay() } } |