Skip to content

Instantly share code, notes, and snippets.

View sauvikatinnofied's full-sized avatar

Sauvik Dolui sauvikatinnofied

View GitHub Profile
@sauvikatinnofied
sauvikatinnofied / ReachabilityChangedFinalFunc.swift
Last active January 19, 2017 15:09
Medium Blog Post Code Snippet
/// Called whenever there is a change in NetworkReachibility Status
///
/// — parameter notification: Notification with the Reachability instance
func reachabilityChanged(notification: Notification) {
let reachability = notification.object as! Reachability
switch reachability.currentReachabilityStatus {
case .notReachable:
debugPrint("Network became unreachable")
@sauvikatinnofied
sauvikatinnofied / ReachabilityManagerStartStop.swift
Created October 24, 2016 06:18
Medium Blog Post Code Snippet
// Start
ReachabilityManager.shared.startMonitoring()
// Stop
ReachabilityManager.shared.stopMonitoring()
@sauvikatinnofied
sauvikatinnofied / LoginButtonIBOutlet.swift
Created October 24, 2016 07:57
Medium Blogpost Code Snippet
// IBOutlets
@IBOutlet var loginButton: UIButton!
@sauvikatinnofied
sauvikatinnofied / AddRemoveListener.swift
Last active January 19, 2017 15:07
Medium Blog Post Gists
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
ReachabilityManager.shared.addListener(listener: self)
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
ReachabilityManager.shared.removeListener(listener: self)
}
extension ViewController: NetworkStatusListener {
func networkStatusDidChange(status: Reachability.NetworkStatus) {
switch status {
case .notReachable:
debugPrint("ViewController: Network became unreachable")
case .reachableViaWiFi:
debugPrint("ViewController: Network reachable through WiFi")
case .reachableViaWWAN:
func networkStatusDidChange(status: Reachability.NetworkStatus) {
switch status {
case .notReachable:
debugPrint("ViewController: Network became unreachable")
case .reachableViaWiFi:
debugPrint("ViewController: Network reachable through WiFi")
case .reachableViaWWAN:
debugPrint("ViewController: Network reachable through Cellular Data")
}
├─ Level // Root Folder
	├─ 3rdParty (Any 3rd party which can not added through package manager)
	├─ AppDelegate
		├─ AppDelegate.swift
		├─ AppDelegateBGSupport.swift (extension of AppDelegate, methods associated with background support (prefetching, download etc))
		├─ AppDelegateNotificationSupport.swift (extension of AppDelegate, methods associated with Notification(Push, Local) support)
	├─ Controllers
		├─ Feedback
			├─ Controllers (View controllers  strictly associated with Feedback Module)
@sauvikatinnofied
sauvikatinnofied / UIColorExtension.swift
Last active July 3, 2020 14:03
MediumBlog Color Constant
extension UIColor {
/**
Creates an UIColor from HEX String in "#363636" format
- parameter hexString: HEX String in "#363636" format
- returns: UIColor from HexString
*/
convenience init(hexString: String) {
@sauvikatinnofied
sauvikatinnofied / ColorScheme.swift
Last active March 23, 2017 12:54
Color Scheme Categories
enum Color {
case theme
case border
case shadow
case darkBackground
case lightBackground
case intermidiateBackground
@sauvikatinnofied
sauvikatinnofied / ThemeColor.swift
Last active March 23, 2017 12:54
MediumBlog Colour schemes
extension Color {
var value: UIColor {
var instanceColor = UIColor.clear
switch self {
case .border:
instanceColor = UIColor(hexString: "#333333")
case .theme:
instanceColor = UIColor(hexString: "#ffcc00")