Skip to content

Instantly share code, notes, and snippets.

View HassanSE's full-sized avatar

Muhammad Hasssan HassanSE

  • Lahore, Pakistan
View GitHub Profile
//
// RxXCTestCase.swift
//
// Created by Muhammad Hassan on 02/12/2020.
// Copyright © 2020 Muhammad Hassan. All rights reserved.
//
import XCTest
import RxSwift
import RxTest
@HassanSE
HassanSE / Memory leak catcher
Created January 30, 2019 06:56
Memory leak catcher
extension UIViewController {
public func dch_checkDeallocation(afterDelay delay: TimeInterval = 5.0) {
let rootParentViewController = dch_rootParentViewController
// We don’t check `isBeingDismissed` simply on this view controller because it’s common
// to wrap a view controller in another view controller (e.g. in UINavigationController)
// and present the wrapping view controller instead.
if isMovingFromParent || rootParentViewController.isBeingDismissed {
let selfType = type(of: self)
protocol <#Inputs#> {
}
protocol <#Outputs#> {
}
protocol <#ViewModelType#> {
var inputs: <#Inputs#> { get }
@HassanSE
HassanSE / Massive View Controller Terminal
Last active July 22, 2018 10:08
Massive View Controller Identification via Terminal
find . -type f -exec wc -l {} + | sort -n
class <#ViewControllerName#>: UIViewController {
// MARK: - Outlets
// MARK: - Properties
// MARK: - View Life Cycle
override func viewDidLoad() {
super.viewDidLoad()
//
// JSONParsing.swift
// hplus-sports
//
// Created by Muhammad Hassan on 9/27/17.
// Copyright © 2017 Lynda.com. All rights reserved.
//
import Foundation
//1
let fetchRequest1 = NSFetchRequest<Venue>()
let entity =
NSEntityDescription.entity(forEntityName: "Venue",
in: managedContext)!
fetchRequest1.entity = entity
// 2
let fetchRequest2 = NSFetchRequest<Venue>(entityName: "Venue")
// 3
let fetchRequest3: NSFetchRequest<Venue> = Venue.fetchRequest()
@HassanSE
HassanSE / CoreDataStack.swift
Created August 9, 2017 17:54
A commonly used CoreData stack
import Foundation
import CoreData
class CoreDataStack {
private let modelName: String
init(modelName: String) {
self.modelName = modelName
}