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
pod 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
node -v | |
// v14.16.0 |
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
// Source: https://medium.com/nice-photon-ios/animator-easy-trick-to-make-uikit-animations-reusable-2d10713ca3a | |
struct Animator { | |
typealias Animations = () -> () | |
typealias Completion = (Bool) -> () | |
let perform: (@escaping Animations, Completion?) -> () | |
} | |
extension UIView { | |
static func animate(with animator: Animator, animations: @escaping () -> (), completion: ((Bool) -> ())? = nil) { |
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 Combine | |
@propertyWrapper | |
struct UserDefault<Value> { | |
let key: String | |
let defaultValue: Value | |
var container: UserDefaults = .standard | |
private let publisher = PassthroughSubject<Value, Never>() | |
var wrappedValue: Value { |
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
// | |
// MapViewController.swift | |
// sampleApp | |
// | |
// Created by Erdem ILDIZ on 4.11.2021. | |
// | |
import UIKit | |
import MapKit |
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
infix operator ++ | |
func ++(initialText: String, nextText: String) -> String { | |
initialText + " " + nextText | |
} | |
// Usage | |
let combinedName = names.reduce("", ++) | |
// Result | |
// My name is Tom |
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
// 1. Method | |
let combinedName = names.reduce(""){ initialText, nextName in "\(initialText) \(nextName)"} | |
// 2. Method | |
let combinedName = names.reduce("", +) | |
// 3. Method | |
let combinedName = numbers.reduce("") { $0 + $1 } | |
// Result |
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
let names = ["My", "name", "is", "Tom"] |
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
// 1. Method | |
let total = numbers.reduce(0) { initialValue, nextValue in | |
return initialValue + nextValue | |
} | |
// 2. Method | |
let total = numbers.reduce(0) { $0 + $1 } | |
// 3. Method | |
let total = numbers.reduce(0, +) |
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
let numbers = Array(1...10) |