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
## REQUEST MAPPING | |
{ | |
"version" : "2017-02-28", | |
"operation" : "Query", | |
"index": "shopID-vendorID-index", | |
"query" : { | |
"expression": "shopID = :shopID AND vendorID = :vendorID", | |
"expressionValues" : { | |
":shopID" : $util.dynamodb.toDynamoDBJson($ctx.args.shopID), | |
":vendorID" : $util.dynamodb.toDynamoDBJson($ctx.args.vendorID) |
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
/* | |
BEFORE = ["id": 1, "sergio": ["yume": ["ssk": 999]], "product": ["name": "AAA", "description": ["banana": "yellow"]]] | |
AFTER = ["sergio/yume/ssk": 999, "id": 1, "product/name": "AAA", "product/description/banana": "yellow"] | |
*/ | |
typealias JSON = [String : Any] | |
let nested: JSON = ["id": 1, "product": ["name": "AAA", "description": ["banana": "yellow"]], "sergio": ["yume": ["ssk": 999]]] | |
extension JSON where Key: ExpressibleByStringLiteral, Value: Any { |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>destination</key> | |
<string>upload</string> | |
<key>method</key> | |
<string>app-store</string> | |
<key>provisioningProfiles</key> | |
<dict> |
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 Optional where Wrapped == String { | |
var orEmpty: Wrapped { | |
return self ?? "" | |
} | |
var isNullOrEmpty: Bool { | |
return self?.isEmpty ?? true | |
} |
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 UIAlertController { | |
// MARK: - Typealias | |
typealias Alert = UIAlertController | |
typealias Action = UIAlertAction | |
typealias Block = ((Alert) -> Void)? | |
// MARK: - Static function | |
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 Reachability | |
final class NetworkListener { | |
private let notification = Notification.Name("NetworkListenerStatusDidChanged") | |
private let reachability: Reachability! | |
/// Return true if connected to Internet | |
private(set) var isConnected: Bool! | |
init() { |
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
func dPrint(_ item: Any) { | |
#if DEBUG | |
Swift.print(item) | |
#endif | |
} | |
final class Log { | |
private enum LogType: String { | |
case error = "[⛔️]" |
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
/** | |
Builder Pattern way to write AutoLayout code | |
Example: | |
```swift | |
AutoLayoutBuilder(button) | |
.bottomTo(view.layoutMarginsGuide.bottomAnchor) | |
.centerXTo(view.centerXAnchor) | |
.width(value: button.width) | |
.height(value: button.height) |
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
/// Return a new function that will be called only once after `delay` time passed between invocation | |
func debounce(delay: TimeInterval, queue: DispatchQueue = .main, function: @escaping () -> Void) -> () -> Void { | |
var currentWorkItem: DispatchWorkItem? | |
return { | |
currentWorkItem?.cancel() | |
currentWorkItem = DispatchWorkItem { function() } | |
queue.asyncAfter(deadline: .now() + delay, execute: currentWorkItem!) | |
} | |
} |
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
/** | |
Flexible and faster way to style your View | |
Example: | |
```swift | |
let label = UILabel() | |
label.styling(UIColor.blue.style, UIFont.boldSystemFont(ofSize: 18).style) | |
``` | |
*/ | |
protocol UIComponentStyler: AnyObject { |