delete abandoned table controller code

This commit is contained in:
Ivan Smolin 2016-10-04 17:48:37 +03:00
parent bd636a8fc3
commit 89b8dfe7c2
6 changed files with 0 additions and 284 deletions

View File

@ -13,11 +13,9 @@
0A3BB9721D5DCFE100B03CBD /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A3BB96E1D5DCFE100B03CBD /* RxSwift.framework */; };
0A3BB9741D5DCFEC00B03CBD /* RxCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A3BB9731D5DCFEC00B03CBD /* RxCocoa.framework */; };
78011A641D47ABC500EA16A2 /* UIView+DefaultReuseIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78011A631D47ABC500EA16A2 /* UIView+DefaultReuseIdentifier.swift */; };
78011A691D47AF5100EA16A2 /* CellCreationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78011A681D47AF5100EA16A2 /* CellCreationType.swift */; };
78011AB31D48B53600EA16A2 /* ApiRequestParameters.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78011AB21D48B53600EA16A2 /* ApiRequestParameters.swift */; };
7824CA521CFEE6B700D7B132 /* UIImage+RenderTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7824CA511CFEE6B700D7B132 /* UIImage+RenderTemplate.swift */; };
7837F60F1CBCF5C0000D74C1 /* EstimatedViewHeightProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7837F60E1CBCF5C0000D74C1 /* EstimatedViewHeightProtocol.swift */; };
785C33451CFC908800C4C4AA /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 785C33441CFC908800C4C4AA /* TableViewController.swift */; };
786A17A11CB8D71D007F9661 /* UIImage+CapInsetsUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 786A17A01CB8D71D007F9661 /* UIImage+CapInsetsUtils.swift */; };
786D78E81D53C378006B2CEA /* AlamofireRequest+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 786D78E71D53C378006B2CEA /* AlamofireRequest+Extensions.swift */; };
786D78EA1D53C43E006B2CEA /* ApiError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 786D78E91D53C43E006B2CEA /* ApiError.swift */; };
@ -25,7 +23,6 @@
787682FA1CAD40C300532AB3 /* StaticEstimatedViewHeightProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 787682F91CAD40C200532AB3 /* StaticEstimatedViewHeightProtocol.swift */; };
787783631CA03CA0001CDC9B /* NSIndexPath+ImmutableIndexPath.swift in Sources */ = {isa = PBXBuildFile; fileRef = 787783621CA03CA0001CDC9B /* NSIndexPath+ImmutableIndexPath.swift */; };
787783671CA04D4A001CDC9B /* String+SizeCalculation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 787783661CA04D4A001CDC9B /* String+SizeCalculation.swift */; };
787A071A1D085750009EC97F /* CellsControllerProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 787A07191D085750009EC97F /* CellsControllerProtocol.swift */; };
788EC15A1CF64528009CFB6B /* UIStoryboard+InstantiateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 788EC1591CF64528009CFB6B /* UIStoryboard+InstantiateViewController.swift */; };
78A74EA91C6B373700FE9724 /* UIView+DefaultNibName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78A74EA81C6B373700FE9724 /* UIView+DefaultNibName.swift */; };
78B0FC7D1C6B2BE200358B64 /* LogFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78B0FC7C1C6B2BE200358B64 /* LogFormatter.swift */; };
@ -49,8 +46,6 @@
78CFEE591C5C45E500F50370 /* StoryboardIdentifierProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78CFEE4E1C5C45E500F50370 /* StoryboardIdentifierProtocol.swift */; };
78CFEE5A1C5C45E500F50370 /* ViewHeightProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78CFEE4F1C5C45E500F50370 /* ViewHeightProtocol.swift */; };
78CFEE5B1C5C45E500F50370 /* ViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78CFEE501C5C45E500F50370 /* ViewModelProtocol.swift */; };
78E59B191C773EE600C6BFE9 /* ObjectsGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78E59B181C773EE600C6BFE9 /* ObjectsGenerator.swift */; };
78E59B1B1C77470A00C6BFE9 /* ViewsGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78E59B1A1C77470A00C6BFE9 /* ViewsGenerator.swift */; };
95B39A781D9BFCC30057BD54 /* UIImageView+LoadingImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95B39A771D9BFCC30057BD54 /* UIImageView+LoadingImage.swift */; };
95B39A7A1D9BFD550057BD54 /* UIImage+Loading.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95B39A791D9BFD550057BD54 /* UIImage+Loading.swift */; };
95B39A7C1D9C05260057BD54 /* UIImage+Gradients.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95B39A7B1D9C05260057BD54 /* UIImage+Gradients.swift */; };
@ -77,11 +72,9 @@
0A3BB96E1D5DCFE100B03CBD /* RxSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RxSwift.framework; sourceTree = "<group>"; };
0A3BB9731D5DCFEC00B03CBD /* RxCocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RxCocoa.framework; sourceTree = "<group>"; };
78011A631D47ABC500EA16A2 /* UIView+DefaultReuseIdentifier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+DefaultReuseIdentifier.swift"; sourceTree = "<group>"; };
78011A681D47AF5100EA16A2 /* CellCreationType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CellCreationType.swift; sourceTree = "<group>"; };
78011AB21D48B53600EA16A2 /* ApiRequestParameters.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApiRequestParameters.swift; sourceTree = "<group>"; };
7824CA511CFEE6B700D7B132 /* UIImage+RenderTemplate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImage+RenderTemplate.swift"; sourceTree = "<group>"; };
7837F60E1CBCF5C0000D74C1 /* EstimatedViewHeightProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EstimatedViewHeightProtocol.swift; sourceTree = "<group>"; };
785C33441CFC908800C4C4AA /* TableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableViewController.swift; sourceTree = "<group>"; };
786A17A01CB8D71D007F9661 /* UIImage+CapInsetsUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImage+CapInsetsUtils.swift"; sourceTree = "<group>"; };
786D78E71D53C378006B2CEA /* AlamofireRequest+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AlamofireRequest+Extensions.swift"; sourceTree = "<group>"; };
786D78E91D53C43E006B2CEA /* ApiError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApiError.swift; sourceTree = "<group>"; };
@ -89,7 +82,6 @@
787682F91CAD40C200532AB3 /* StaticEstimatedViewHeightProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StaticEstimatedViewHeightProtocol.swift; sourceTree = "<group>"; };
787783621CA03CA0001CDC9B /* NSIndexPath+ImmutableIndexPath.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSIndexPath+ImmutableIndexPath.swift"; sourceTree = "<group>"; };
787783661CA04D4A001CDC9B /* String+SizeCalculation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+SizeCalculation.swift"; sourceTree = "<group>"; };
787A07191D085750009EC97F /* CellsControllerProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CellsControllerProtocol.swift; sourceTree = "<group>"; };
788EC1591CF64528009CFB6B /* UIStoryboard+InstantiateViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIStoryboard+InstantiateViewController.swift"; sourceTree = "<group>"; };
78A74EA81C6B373700FE9724 /* UIView+DefaultNibName.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "UIView+DefaultNibName.swift"; path = "LeadKit/Extensions/UIView/UIView+DefaultNibName.swift"; sourceTree = SOURCE_ROOT; };
78B0FC7C1C6B2BE200358B64 /* LogFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LogFormatter.swift; sourceTree = "<group>"; };
@ -116,8 +108,6 @@
78CFEE4E1C5C45E500F50370 /* StoryboardIdentifierProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoryboardIdentifierProtocol.swift; sourceTree = "<group>"; };
78CFEE4F1C5C45E500F50370 /* ViewHeightProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewHeightProtocol.swift; sourceTree = "<group>"; };
78CFEE501C5C45E500F50370 /* ViewModelProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewModelProtocol.swift; sourceTree = "<group>"; };
78E59B181C773EE600C6BFE9 /* ObjectsGenerator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectsGenerator.swift; sourceTree = "<group>"; };
78E59B1A1C77470A00C6BFE9 /* ViewsGenerator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewsGenerator.swift; sourceTree = "<group>"; };
95B39A771D9BFCC30057BD54 /* UIImageView+LoadingImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "UIImageView+LoadingImage.swift"; path = "UIImageView/UIImageView+LoadingImage.swift"; sourceTree = "<group>"; };
95B39A791D9BFD550057BD54 /* UIImage+Loading.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImage+Loading.swift"; sourceTree = "<group>"; };
95B39A7B1D9C05260057BD54 /* UIImage+Gradients.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImage+Gradients.swift"; sourceTree = "<group>"; };
@ -166,7 +156,6 @@
78011A651D47AF3000EA16A2 /* Enums */ = {
isa = PBXGroup;
children = (
78011A681D47AF5100EA16A2 /* CellCreationType.swift */,
786D78E91D53C43E006B2CEA /* ApiError.swift */,
);
path = Enums;
@ -188,15 +177,6 @@
path = Api;
sourceTree = "<group>";
};
785C33431CFC89EF00C4C4AA /* Controllers */ = {
isa = PBXGroup;
children = (
785C33441CFC908800C4C4AA /* TableViewController.swift */,
);
name = Controllers;
path = ../Controllers;
sourceTree = "<group>";
};
786D78E61D53C355006B2CEA /* Alamofire */ = {
isa = PBXGroup;
children = (
@ -226,8 +206,6 @@
78A74EAA1C6B401800FE9724 /* Classes */ = {
isa = PBXGroup;
children = (
785C33431CFC89EF00C4C4AA /* Controllers */,
78E59B171C773E9600C6BFE9 /* Cache */,
78B0FC7B1C6B2BAE00358B64 /* Logging */,
);
path = Classes;
@ -330,20 +308,10 @@
78CFEE501C5C45E500F50370 /* ViewModelProtocol.swift */,
787682F91CAD40C200532AB3 /* StaticEstimatedViewHeightProtocol.swift */,
7837F60E1CBCF5C0000D74C1 /* EstimatedViewHeightProtocol.swift */,
787A07191D085750009EC97F /* CellsControllerProtocol.swift */,
);
path = Protocols;
sourceTree = "<group>";
};
78E59B171C773E9600C6BFE9 /* Cache */ = {
isa = PBXGroup;
children = (
78E59B181C773EE600C6BFE9 /* ObjectsGenerator.swift */,
78E59B1A1C77470A00C6BFE9 /* ViewsGenerator.swift */,
);
path = Cache;
sourceTree = "<group>";
};
78E59B2B1C786CBF00C6BFE9 /* UITableView */ = {
isa = PBXGroup;
children = (
@ -558,8 +526,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
78011A691D47AF5100EA16A2 /* CellCreationType.swift in Sources */,
785C33451CFC908800C4C4AA /* TableViewController.swift in Sources */,
7837F60F1CBCF5C0000D74C1 /* EstimatedViewHeightProtocol.swift in Sources */,
78CFEE541C5C45E500F50370 /* UIView+LoadFromNib.swift in Sources */,
78CFEE521C5C45E500F50370 /* UITableView+CellRegistration.swift in Sources */,
@ -573,18 +539,15 @@
786D78EC1D53C46E006B2CEA /* AlamofireManager+Extensions.swift in Sources */,
95B39A841D9C0C3E0057BD54 /* UIImage+Alpha.swift in Sources */,
95B39A801D9C09440057BD54 /* UIImage+Cropping.swift in Sources */,
78E59B1B1C77470A00C6BFE9 /* ViewsGenerator.swift in Sources */,
78B0FC811C6B2CD500358B64 /* App.swift in Sources */,
78C36F771D80117D00E7EBEA /* UIImage+Transformations.swift in Sources */,
786D78EA1D53C43E006B2CEA /* ApiError.swift in Sources */,
787A071A1D085750009EC97F /* CellsControllerProtocol.swift in Sources */,
95B39A861D9D51250057BD54 /* String+Localization.swift in Sources */,
78C36F7E1D801E3E00E7EBEA /* Double+Rounding.swift in Sources */,
78CFEE551C5C45E500F50370 /* NibNameProtocol.swift in Sources */,
78CFEE561C5C45E500F50370 /* ReuseIdentifierProtocol.swift in Sources */,
786D78E81D53C378006B2CEA /* AlamofireRequest+Extensions.swift in Sources */,
78C36F811D8021DD00E7EBEA /* UIColor+Hex.swift in Sources */,
78E59B191C773EE600C6BFE9 /* ObjectsGenerator.swift in Sources */,
78CFEE5B1C5C45E500F50370 /* ViewModelProtocol.swift in Sources */,
78C36F7B1D8015ED00E7EBEA /* UIImage+Creation.swift in Sources */,
95B39A7A1D9BFD550057BD54 /* UIImage+Loading.swift in Sources */,

View File

@ -1,57 +0,0 @@
//
// ObjectsPool.swift
// LeadKit
//
// Created by Иван Смолин on 19/02/16.
// Copyright © 2016 Touch Instinct. All rights reserved.
//
import Foundation
/// class that generates objects on initialization phase and then return its when necessary
public class ObjectsGenerator<T> {
private var objects = [T]()
private let poolSize: UInt
typealias ObjectConstructor = () -> T
private let objectsContructor: ObjectConstructor
private let serialQueue = dispatch_queue_create("ru.touchin.LeadKit.ObjectsGenerator<\(T.self)>", DISPATCH_QUEUE_SERIAL)
/**
initializer function
- parameter poolSize: number of objects to generate
- parameter contructor: objects constructor closure
*/
init(poolSize: UInt, objectsContructor contructor: ObjectConstructor) {
self.poolSize = poolSize
self.objectsContructor = contructor
fillPool()
}
private func fillPool() {
for _ in 0..<poolSize {
objects.append(objectsContructor())
}
}
/**
method which returns object from pool
- returns: object from pool
*/
public func get() -> T {
dispatch_sync(serialQueue) {
if self.objects.count < 1 {
self.fillPool()
}
}
return objects.popLast()!
}
}

View File

@ -1,23 +0,0 @@
//
// TableViewCellsPool.swift
// LeadKit
//
// Created by Иван Смолин on 19/02/16.
// Copyright © 2016 Touch Instinct. All rights reserved.
//
import Foundation
/// class that generates views on initialization phase and then return its when necessary
public class ViewsGenerator<T where T: UIView>: ObjectsGenerator<T> {
/**
initializer function
- parameter poolSize: number of cells to generate
- parameter nibName: view nib name
*/
init(poolSize: UInt, nibName: String) {
super.init(poolSize: poolSize, objectsContructor: { T.loadFromNib(named: nibName) })
}
}

View File

@ -1,109 +0,0 @@
//
// TableViewController.swift
// LeadKit
//
// Created by Ivan Smolin on 30/05/16.
// Copyright © 2016 Touch Instinct. All rights reserved.
//
import UIKit
public class TableViewController: UITableViewController, CellsControllerProtocol {
private var cellsObjectsCreators: [String: ViewsGenerator<UITableViewCell>] = [:]
private let cellCreationType: CellCreationType
private static let creationTypeKey = "CellCreationType"
// MARK: - Initialization
public init(style: UITableViewStyle, cellCreationType: CellCreationType = .OnTheFlight) {
self.cellCreationType = cellCreationType
super.init(style: style)
}
public required init?(coder aDecoder: NSCoder) {
if let creationType = CellCreationType(rawValue: aDecoder.decodeIntegerForKey(TableViewController.creationTypeKey)) {
cellCreationType = creationType
super.init(coder: aDecoder)
} else {
return nil
}
}
public override func encodeWithCoder(aCoder: NSCoder) {
super.encodeWithCoder(aCoder)
aCoder.encodeInteger(cellCreationType.rawValue, forKey: TableViewController.creationTypeKey)
}
/**
method which adds cells generator for cells with specified reuse identifier
- parameter cellsGenerator: cells generator
- parameter cellIdentifier: cell reuse identifier
*/
public func registerCellsGenerator(cellsGenerator: ViewsGenerator<UITableViewCell>,
forCellsWithIdentifier cellIdentifier: String) {
cellsObjectsCreators[cellIdentifier] = cellsGenerator
}
// MARK: - UITableViewDataSource
public override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell: UITableViewCell
let cellIdentifier = cellIdentifierForIndexPath(indexPath)
switch cellCreationType {
case .OnTheFlight:
cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath)
case .Preloaded:
guard let cellsGenerator = cellsObjectsCreators[cellIdentifier] else {
fatalError("You should register view generator for cell with identifier \"\(cellIdentifier)\"")
}
cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier) ?? cellsGenerator.get()
}
configureCell(cell, atIndexPath: indexPath)
return cell
}
// MARK: - Cells сontroller stub implementation
/**
method which returns reuse identifier for cell at specified index path
- parameter indexPath: NSIndexPath object
- returns: reuse identifier
*/
public func cellIdentifierForIndexPath(indexPath: NSIndexPath) -> String {
fatalError("Your should implement cellIdentifierForIndexPath(_:)")
}
/**
method which configures cell before it can be used
- parameter cell: UITableView or subclass cell
- parameter atIndexPath: index path of cell
*/
public func configureCell(cell: UITableViewCell, atIndexPath: NSIndexPath) {
// intended to be implemented in subclasses
}
/**
method which return height for cell at specified index path
- parameter indexPath: NSIndexPath object
- returns: height of cell at specified index path
*/
public func heightForCellAtIndexPath(indexPath: NSIndexPath) -> CGFloat {
// intended to be implemented in subclasses
return UITableViewAutomaticDimension
}
}

View File

@ -1,22 +0,0 @@
//
// CellCreationType.swift
// LeadKit
//
// Created by Ivan Smolin on 26/07/16.
// Copyright © 2016 Touch Instinct. All rights reserved.
//
import Foundation
/**
enum which describes cell creation behaviour of CellsControllerProtocol
- Preloaded: cells is generated in advance
- OnTheFlight: cells is created on demand
*/
public enum CellCreationType: Int {
case Preloaded = 0
case OnTheFlight = 1
}

View File

@ -1,36 +0,0 @@
//
// CellsControllerProtocol.swift
// LeadKit
//
// Created by Ivan Smolin on 08/06/16.
// Copyright © 2016 Touch Instinct. All rights reserved.
//
import Foundation
/**
* protocol which ensures that specific type can configure cell and return cell attributes for specific index path
*/
public protocol CellsControllerProtocol {
associatedtype CellType
/**
method which returns cell identifier for given index path
- parameter indexPath: NSIndexPath object
- returns: cell identifier for specified index path
*/
func cellIdentifierForIndexPath(indexPath: NSIndexPath) -> String
/**
method which configures given cell for given index path
- parameter cell: cell to configure
- parameter atIndexPath: index path of given cell
- returns: nothing
*/
func configureCell(cell: CellType, atIndexPath: NSIndexPath)
}