Skip to content

Instantly share code, notes, and snippets.

View Shadester's full-sized avatar

Erik Lindberg Shadester

View GitHub Profile
//
// RxDataSources+SkeletonView.swift
//
// Created by mack on 4/7/20.
//
import Foundation
import UIKit
import RxSwift
import RxDataSources
@jnewc
jnewc / NotesApp.swift
Last active January 21, 2024 17:40
A notes app written in >100 lines of swift using SwiftUI
import SwiftUI
let dateFormatter = DateFormatter()
struct NoteItem: Codable, Hashable, Identifiable {
let id: Int
let text: String
var date = Date()
var dateText: String {
dateFormatter.dateFormat = "MMM d yyyy, h:mm a"
@mcichecki
mcichecki / Reactive+UISearchController.swift
Created August 17, 2018 16:22
UISearchResultsUpdating proxy for UISearchController with RxSwift and RxCocoa
import RxCocoa
import RxSwift
public extension Reactive where Base: UISearchController {
var delegate: DelegateProxy<UISearchController, UISearchResultsUpdating> {
return RxSearchResultsUpdatingProxy.proxy(for: base)
}
var searchPhrase: Observable<String> {
@IanKeen
IanKeen / gist:dfbe42fea3f5746e87aebac86d508f7e
Last active January 14, 2021 00:18
Getting playgrounds working in a project in xcode
1. Create a new xcode project
- You can skip this if you're adding the playground to an existing project
2. File > Save as workspace - save workspace in project folder
- You can skip this if you're adding the playground to an existing workspace
3. File > Playground - create new playground in project folder
4. Drag playground in at the _workspace_ level (root item, i.e. _not_ under the project)
5. Add a new Framework to your project (I usually name mine something like 'PlaygroundKit')
- You don't need to include tests
- Choose 'None' for Enbed in Application
6. Make all project files you want to be accessible to the playground are members of the new target
//
// PaginationNetworkLogic.swift
//
// Created by Daniel Tartaglia on 4/9/17.
// Copyright © 2019 Daniel Tartaglia. MIT License
//
import RxSwift
struct PaginationUISource {
@kishikawakatsumi
kishikawakatsumi / ReorderingRealmListInTableView.swift
Created July 27, 2016 04:59
Reorder Realm List in UITableView
import UIKit
import RealmSwift
class Data: Object {
dynamic var name = ""
...
}
class DataWrapper: Object {
let list = List<Data>()
@kishikawakatsumi
kishikawakatsumi / ReorderingRealmResultsInTableView.swift
Created July 27, 2016 04:51
Reorder Realm Results in UITableView
import UIKit
import RealmSwift
class Data: Object {
dynamic var name = ""
...
dynamic var order = 0 // 並べ替えのためのカラムが必要
}