Skip to content

Instantly share code, notes, and snippets.

Registration Flow - iOS

A crucial type in the app is the CognitoStore. There's only ever one instance of this type that lives throughout the life-cycle of the app. Everywhere in our app, a dev has access to this one instance through the sharedInstance static stored property on the CognitoStore.

Important to note is the init function on this type. It sets everything up, most imporantly the userPool stored property of type AWSCognitoIdentityUserPool. This in turn will provide access to the AWSCognitoIdentityUser that exists on the AWSCognitoIdentityUserPool. This is done by calling currentUser() on the AWSCognitoIdentityUserPool instance.

We expose the AWSCognitoIdentityUser in the form of a computed property named currentUser.

Here's how accessing this currentUser looks like throughout the app:

@Reyurnible
Reyurnible / Variable.kt
Last active March 28, 2018 05:30
RxSwift's Variable.swfit convert to Kotlin
import io.reactivex.Observable
import io.reactivex.subjects.BehaviorSubject
/**
* Wrapping Rx BehaviorSubject defaultValue object.
* RxSwfit Variable.swfit https://github.com/jspahrsummers/RxSwift/blob/master/RxSwift/SpinLock.swift
*/
class Variable<T> private constructor(defaultValue: T?) {
companion object {
fun <T> create(): Variable<T> = Variable(null)
@macsystems
macsystems / AndroidFontFamiliesByVersion.mk
Last active August 15, 2017 20:28
Font Families on Android Versions
Added in Android Jelly Bean (4.1) - API 16 :
Regular (default):
<item name="android:fontFamily">sans-serif</item>
<item name="android:textStyle">normal</item>
Italic:
<item name="android:fontFamily">sans-serif</item>
@Rcureton
Rcureton / The Technical Interview Cheat Sheet.md
Created June 28, 2016 17:31 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@raheelahmad
raheelahmad / gist:3f48bc5fc83a4a611904
Last active August 29, 2015 14:06
Core Data stack in Swift
//
// PersistenceStack.swift
import CoreData
public class PersistenceStack: NSObject {
let mainContext: NSManagedObjectContext = {
let context = NSManagedObjectContext(concurrencyType: .MainQueueConcurrencyType)
context.undoManager = nil
context.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy