Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Eric Lewis ericlewis

🏠
Working from home
Block or report user

Report or block ericlewis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ericlewis
ericlewis / tinyotp.swift
Created Sep 17, 2019
A tiny pure swift implementation of HOTP & TOTP
View tinyotp.swift
import Foundation
import CryptoKit
protocol PasswordProtocol {
var id: UUID {get}
var name: String {get}
var issuer: String {get}
var image: URL? {get}
var generator: GeneratorProtocol {get}
}
@ericlewis
ericlewis / reswift+swiftui.swift
Last active Sep 17, 2019
Example of using ReSwift with SwiftUI
View reswift+swiftui.swift
import SwiftUI
import ReSwift
// MARK: ReSwift Example Setup
struct AppState: StateType {
var counter: Int = 0
}
struct CounterActionIncrease: Action {}
View gist:3ba58abb7a0ebeb65db3dabde8a7b217
@objc(ExampleViewManager)
class ExampleViewManager: RCTViewManager {
override func view() -> UIView! {
let scratchyView = ScratchyView()
scratchyView.delegate = self
return scratchyView
}
}
extension ExampleViewManager: ScratchyDelegate {
View Search.swift
import SwiftUI
struct SearchNavigationView<Content: View>: UIViewControllerRepresentable {
@Binding var searchText: String
@Binding var scope: Int
var showScope: Bool = false
var content: () -> Content
func makeCoordinator() -> Coordinator {
Coordinator(self)
@ericlewis
ericlewis / CoreDataList.swift
Created Aug 8, 2019
Demonstration of using Core Data with SwiftUI
View CoreDataList.swift
//
// ContentView.swift
// CoreDataSwiftUISample
//
// Created by Eric Lewis on 8/8/19.
// Copyright © 2019 Eric Lewis, Inc. All rights reserved.
//
import SwiftUI
import CoreData
View MusicKittySchema.js
const { gql } = require("apollo-server");
const typeDefs = gql`
type PageInfo {
hasNextPage: Boolean
}
type ArtistEdge {
node: Artist
}
View gist:9aa58eb32d74ce757353f8e79a1ddc61
### Keybase proof
I hereby claim:
* I am ericlewis on github.
* I am ericlewis (https://keybase.io/ericlewis) on keybase.
* I have a public key ASBzIjHMyqm5H8e3230zlAxaBzQMVO1pSYwnw0a_TeEYYgo
To claim this, I am signing this object:
View representable.swift
@propertyWrapper
public struct UserDefault<T>: UserDefaultSpec {
let key: String
let defaultValue: T
public init(_ key: String, defaultValue: T) {
self.key = key
self.defaultValue = defaultValue
}
View CakeView.swift
//
// CircularProgress.swift
// Time!
//
// Created by Eric Lewis on 6/9/19.
// Copyright © 2019 Eric Lewis, Inc. All rights reserved.
//
import SwiftUI
View card.tsx
import React, { useEffect, useRef } from "react";
import {
Animated,
Dimensions,
Image,
StyleSheet,
Text,
TouchableOpacity,
} from "react-native";
import Config from "react-native-config";
You can’t perform that action at this time.