Skip to content

Instantly share code, notes, and snippets.


Frank Rausch frankrausch

View GitHub Profile
View NetworkingLayerCombine.swift
import PlaygroundSupport
import Foundation
import Combine
// MARK: - Network Controller
protocol NetworkControllerProtocol: class {
typealias Headers = [String: Any]
func get<T>(type: T.Type,
url: URL,
ethanhuang13 / FacebookAuth.swift
Last active Oct 27, 2021
FacebookAuth is for iOS app developers who need to support Facebook login but don't want to use the official SDK
View FacebookAuth.swift
// FacebookAuth.swift
// GitHub: ethanhuang13
// Twitter: @ethanhuang13
import AuthenticationServices
import SafariServices
douglashill / updateSafeAreaForKeyboardFromNotification.swift
Last active May 6, 2021
Avoid the keyboard by leveraging additionalSafeAreaInsets.
View updateSafeAreaForKeyboardFromNotification.swift
// Avoids the keyboard in a UIKit app by leveraging additionalSafeAreaInsets.
// You can put this in the root view controller so the whole app will avoid the keyboard.
// Only tested on iOS 13.3.
// Made for
@objc func updateSafeAreaForKeyboardFromNotification(_ notification: Notification) {
guard let endFrameInScreenCoords = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect else {
// Please consider whether the force unwrap here is safe for your own use case.
stinger / CombineFetcher.swift
Last active Aug 15, 2021
Combine - fetching data using URLSession publishers
View CombineFetcher.swift
import Foundation
import Combine
enum APIError: Error, LocalizedError {
case unknown, apiError(reason: String)
var errorDescription: String? {
switch self {
case .unknown:
return "Unknown error"
View asyncimages.swift
final class Loader: BindableObject {
let didChange = PassthroughSubject<Data?, Never>()
var task: URLSessionDataTask!
var data: Data? = nil {
didSet {
init(_ url: URL) {