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 | |
protocol ItemsTableViewDatasource: UITableViewDataSource { | |
associatedtype T | |
var items:[T] {get} | |
weak var tableView: UITableView? {get} | |
weak var delegate: UITableViewDelegate? {get} | |
init(items: [T], tableView: UITableView, delegate: UITableViewDelegate) | |
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
final class CharactersDatasource: NSObject, ItemsTableViewDatasource { | |
var items:[Character] = [] | |
weak var tableView: UITableView? | |
weak var delegate: UITableViewDelegate? | |
required init(items: [Character], tableView: UITableView, delegate: UITableViewDelegate) { | |
self.items = items | |
self.tableView = tableView | |
self.delegate = delegate |
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
protocol ReusableTableViewCell { | |
} | |
extension ReusableTableViewCell where Self: UITableViewCell { | |
static func cellIdentifier() -> String { | |
return String(describing: Self.self) | |
} | |
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 Kingfisher | |
extension UIImageView { | |
func download(image url: String) { | |
guard let imageURL = URL(string:url) else { | |
return | |
} | |
self.kf.setImage(with: ImageResource(downloadURL: imageURL)) | |
} |
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
final class CharacterTableCell: UITableViewCell, NibReusable { | |
@IBOutlet weak var name: UILabel! | |
@IBOutlet weak var thumb: UIImageView! | |
static func height() -> CGFloat { | |
return 80 | |
} | |
func setup(item: Character) { | |
name.text = item.name |
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
# Uncomment the next line to define a global platform for your project | |
platform :ios, '9.0' | |
target 'Marvel' do | |
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks | |
use_frameworks! | |
plugin 'cocoapods-keys', { | |
:project => "Marvel", | |
:keys => [ |
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
# frozen_string_literal: true | |
source "https://rubygems.org" | |
# gem "rails" | |
gem "cocoapods", "1.1.1" | |
gem "cocoapods-keys", "1.7.0" | |
gem "slather", "2.3.0" | |
gem "fastlane", "1.110.0" |
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
fastlane_version "1.110.0" | |
default_platform :ios | |
platform :ios do | |
before_all do | |
# ENV["SLACK_URL"] = "https://hooks.slack.com/services/..." | |
cocoapods | |
end |
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 Foundation | |
import ObjectMapper | |
@testable import Marvel | |
struct MockLoader { | |
let data: Data | |
let json: String | |
init?(file: String, withExtension fileExt: String = "json", in bundle:Bundle = Bundle.main) { |