This file contains hidden or 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 { | |
convenience init(hex: String) { | |
var cString: String = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased() | |
if cString.hasPrefix("#") { | |
cString.remove(at: cString.startIndex) | |
} |
This file contains hidden or 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
private var items: [GymShort] = [] { | |
willSet { | |
let old = Array(Set(items).subtracting(Set(newValue))) | |
view.remove(old) | |
} | |
didSet { | |
let new = Array(Set(items).subtracting(Set(oldValue))) | |
view.add(new) | |
} | |
} |
This file contains hidden or 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
// TODO: Add Jacoco dependency | |
buildscript { | |
repositories { | |
google() | |
jcenter() | |
} | |
dependencies { | |
.......... | |
classpath "com.dicedmelon.gradle:jacoco-android:0.1.1" |
This file contains hidden or 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
// TODO: Implement plugin | |
apply plugin: 'jacoco-android' | |
// TODO: Setup test coverage for build type | |
android { | |
buildTypes { | |
debug { | |
testCoverageEnabled = true |
This file contains hidden or 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
func setData(title: String, timeInterval: NSTimeInterval, description: String) { | |
let dateNews = NSDate(timeIntervalSince1970: timeInterval) | |
let dateFormater : NSDateFormatter = NSDateFormatter() | |
dateFormater.timeZone = NSTimeZone.localTimeZone() | |
dateFormater.dateFormat = "HH:mm. dd MMMM" | |
_dateLabel.text = dateFormater.stringFromDate(dateNews) | |
_titleNewsLabel.text = title | |
_titleNewsLabel.adjustsFontSizeToFitWidth = false | |
let constraint = CGSizeMake(_titleNewsLabel.frame.size.width, CGFloat.max); |
This file contains hidden or 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
//: A UIKit based Playground for presenting user interface | |
import CoreGraphics | |
import UIKit | |
import PlaygroundSupport | |
class DrawView: UIView { | |
override func draw(_ rect: CGRect) { | |
super.draw(rect) |
This file contains hidden or 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
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import PlaygroundSupport | |
class MyViewController : UIViewController { | |
override func loadView() { | |
let view = UIView() | |
view.backgroundColor = .white |
This file contains hidden or 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
struct User { | |
let name: String | |
} | |
var users: [User] = [] |
This file contains hidden or 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
users.append(User(name: "Maxim Vialyx")) | |
// [{name "Maxim Vialyx"}] | |
users.remove(at: 0) | |
// [] | |
users.append(User(name: "Medium Guest")) | |
// [{name "Medium Guest"}] | |
users.removeFirst() | |
// [] |
This file contains hidden or 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
let admins = [User(name: "Admin")] | |
// [{name "Admin"}] | |
let guests = [User(name: "Guest")] | |
// [{name "Guest"}] | |
var allUsers = admins + guests | |
// [{name "Admin"}, {name "Guest"}] | |
// TODO: - Use .isEmpty instead of .count | |
if allUsers.isEmpty { |