This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import Foundation | |
class Stack { | |
static let list = Stack.init() | |
private var items = Array<Any>() | |
internal var limit = 5 | |
//MARK: Push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyLabel: UILabel { | |
var textWillChange:((_ oldText: String?)->())? = nil | |
var textDidChange:((_ newText: String?)->())? = nil | |
override var text: String? { | |
willSet { | |
if textWillChange != nil { | |
textWillChange!(self.text) | |
} | |
} | |
didSet { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import Reachability | |
class NetworkMonitor { | |
static let shared = NetworkMonitor() | |
internal var isNetworkAvailable : Bool { | |
get { | |
return networkStatus != .none | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [START receive_message] | |
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) { | |
// If you are receiving a notification message while your app is in the background, | |
// this callback will not be fired till the user taps on the notification launching the application. | |
// TODO: Handle data of notification | |
// With swizzling disabled you must let Messaging know about the message, for Analytics | |
// Messaging.messaging().appDidReceiveMessage(userInfo) | |
// Print full message. | |
print(userInfo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
// ---- [LoginManager.swift] ---- starts | |
enum LoginError: Error { | |
case minUserNameLength(String), minPasswordLength(String), invalidUserName(String), invalidPassword(String) | |
} | |
enum LoginResult { | |
case result([String: Any]) | |
} |