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
############################################## | |
# .gitignore for Xcode 5 Project # | |
# https://gist.github.com/bartjacobs/8334797 # | |
############################################## | |
# Temporary Files OS X | |
.DS_Store | |
*.swp | |
*.lock |
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
- (void)layoutSubviews { | |
[super layoutSubviews]; | |
// Helpers | |
CGRect bounds = self.contentView.bounds; | |
// Update Frames | |
CGRect frameTextLabel = self.textLabel.frame; | |
CGRect frameDetailTextLabel = self.detailTextLabel.frame; | |
CGRect frameActivityIndicatorView = self.activityIndicatorView.frame; |
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 | |
enum API { | |
static let baseURL = URL(string: "https://cocoacasts.com")! | |
} | |
class NetworkManager { |
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 | |
struct WeatherDayData { | |
let time: Date | |
let icon: String | |
let windSpeed: Double? | |
let temperatureMin: Double | |
let temperatureMax: Double |
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 ReusableView { | |
static var reuseIdentifier: String { get } | |
} | |
extension ReusableView { |
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 | |
extension UIColor { | |
// MARK: - Initialization | |
convenience init?(hex: String) { | |
var hexSanitized = hex.trimmingCharacters(in: .whitespacesAndNewlines) | |
hexSanitized = hexSanitized.replacingOccurrences(of: "#", with: "") |
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 Unbox | |
struct Restaurant: Unboxable { | |
let features: [Feature] | |
init(unboxer: Unboxer) throws { | |
self.features = try unboxer.unbox(key: "features") | |
} | |
} |
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
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
guard let cell = tableView.dequeueReusableCell(withIdentifier: SettingsTableViewCell.reuseIdentifier, for: indexPath) as? SettingsTableViewCell else { fatalError("Unexpected Index Path") } | |
// Configure Cell | |
... | |
return cell | |
} |
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 | |
enum Section: Int { | |
case news | |
case profile | |
case settings | |
var title: String { | |
switch 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
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
if let cell = tableView.dequeueReusableCell(withIdentifier: SettingsTableViewCell.reuseIdentifier, for: indexPath) as? SettingsTableViewCell { | |
// Configure Cell | |
cell.textLabel?.text = "Some Setting" | |
return cell | |
} else { | |
return UITableViewCell() | |
} |
OlderNewer