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
pod install |
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
# Uncomment the next line to define a global platform for your project | |
# platform :ios, '9.0' | |
target 'socket-demo' do | |
# Comment the next line if you don't want to use dynamic frameworks | |
use_frameworks! | |
pod 'Socket.IO-Client-Swift', '~> 15.2.0' | |
# Pods for socket-demo | |
end |
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
pod init |
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
node -v | |
// v14.16.0 |
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
// 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 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 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 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
// | |
// MapViewController.swift | |
// sampleApp | |
// | |
// Created by Erdem ILDIZ on 4.11.2021. | |
// | |
import UIKit | |
import MapKit |
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
infix operator ++ | |
func ++(initialText: String, nextText: String) -> String { | |
initialText + " " + nextText | |
} | |
// Usage | |
let combinedName = names.reduce("", ++) | |
// Result | |
// My name is Tom |
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
// 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 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
let names = ["My", "name", "is", "Tom"] |