Skip to content

Instantly share code, notes, and snippets.

View shakemno's full-sized avatar

Manolis Pahlke shakemno

View GitHub Profile
@shakemno
shakemno / 0. Reference
Created December 8, 2019 18:13 — forked from lamprosg/0. Reference
(iOS) SwiftUI tutorial
//https://www.hackingwithswift.com/quick-start/swiftui
@shakemno
shakemno / SwiftEventHandler.swift
Created December 8, 2019 18:14 — forked from lamprosg/SwiftEventHandler.swift
(iOS) Swift only KVO alternative, event handlers
//Documentation
//https://blog.scottlogic.com/2015/02/05/swift-events.html
//KVO example (not shown in this gist)
//https://blog.scottlogic.com/2015/02/11/swift-kvo-alternatives.html
public class Event<T> {
public typealias EventHandler = T -> ()
@shakemno
shakemno / gcd.swift
Created December 8, 2019 18:16 — forked from lamprosg/gcd.swift
(iOS) GCD
//https://medium.com/@nimjea/grand-central-dispatch-in-swift-fdfdd8b22d52
DispatchQueue.main.async {
// Perform your async code here
}
//Synced operations
let northZone = DispatchQueue(label: "perform_task_with_team_north")
//Sync operation
@shakemno
shakemno / AECoreData.swift
Created December 9, 2019 21:50 — forked from tadija/AECoreData.swift
AECoreData
/**
* https://gist.github.com/tadija/6003830264d67a87193ff0c3d20373e7
* Copyright (c) Marko Tadić 2018
* Licensed under the MIT license. See LICENSE file.
*/
import CoreData
extension NSFetchRequestResult where Self: NSManagedObject {
// MARK: Queries
@shakemno
shakemno / FRP iOS Learning resources.md
Created December 18, 2019 19:25 — forked from JaviLorbada/FRP iOS Learning resources.md
The best FRP iOS resources.

Videos

@shakemno
shakemno / Playground.swift
Created January 8, 2020 17:54 — forked from timdonnelly/Playground.swift
Maintaining visible scroll position while inserting items in a UICollectionView (Swift playground)
import Foundation
import UIKit
import XCPlayground
XCPlaygroundPage.currentPage.needsIndefiniteExecution = true
class Layout: UICollectionViewLayout {
private var attributes: [[UICollectionViewLayoutAttributes]] = []
@shakemno
shakemno / UIViewController+Helpers.swift
Last active February 24, 2020 15:21 — forked from Ankit-Aggarwal/UIViewController+Helpers
UIViewController Extension to handle keyboard updates easily
import Foundation
import UIKit
import ReactiveSwift
import Result
extension UIViewController {
typealias KeyboardStatusInfo = (height: CGFloat , duration: TimeInterval, animationOptions: UIViewAnimationOptions)
var keyboardUpdatesSignal: Signal<KeyboardStatusInfo, NoError> {
//------------------------------------------------------------------------
// The SwiftUI Lab: Advanced SwiftUI Animations
// https://swiftui-lab.com/swiftui-animations-part1 (Animating Paths)
// https://swiftui-lab.com/swiftui-animations-part2 (GeometryEffect)
// https://swiftui-lab.com/swiftui-animations-part3 (AnimatableModifier)
//------------------------------------------------------------------------
import SwiftUI
struct ContentView: View {
//
// WatchSessionManager.swift
// WatchConnectivityDemo
//
// Created by Natasha Murashev on 9/3/15.
// Copyright © 2015 NatashaTheRobot. All rights reserved.
//
import WatchConnectivity
@shakemno
shakemno / ScrollableView.swift
Created January 26, 2020 00:09 — forked from jfuellert/ScrollableView.swift
A scrollable SwiftUI view, UIScrollView wrapper. ScrollableView lets you read and write content offsets for scrollview in SwiftUI, with and without animations.
import SwiftUI
struct ScrollableView<Content: View>: UIViewControllerRepresentable {
// MARK: - Type
typealias UIViewControllerType = UIScrollViewController<Content>
// MARK: - Properties
var offset: Binding<CGPoint>
var animationDuration: TimeInterval