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
class ViewModelTests: XCTestCase { | |
var sut: ViewModel! | |
var logger: MockLoggerProtocol! | |
override func setUpWithError() throws { | |
} | |
override func tearDownWithError() throws { | |
} |
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 labelCache = [IndexPath: UILabel]() | |
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
... | |
if labelCache[indexPath] == nil { | |
let label = UILabel() | |
label.text = ... | |
labelCache[indexPath] = label | |
} |
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
Rank | Nick Name | Last Cashback Date | Total Cashback | Boosted Cashback | |
---|---|---|---|---|---|
1 | QueenOfCashback | 23/02/2020 | 1024SGD | 256SGD | |
2 | Yu...LA6n4W | 04/02/2020 | 666SGD | 222SGD | |
3 | ChaChaCha | 03/02/2020 | 444SGD | 111SGD |
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
Base(MB) | After(MB) | Diff(MB) | ||
---|---|---|---|---|
Simple Label | 6.34 | 6.59 | 0.25 | |
Simple Label with Nilify | 6.46 | 6.48 | 0.02 | |
Cached Simple Label | 6.57 | 11.71 | 5.14 | |
Attributed Label | 6.38 | 6.53 | 0.15 | |
Attributed Label with Nilify | 6.50 | 6.61 | 0.11 | |
Cached Attributed Label | 6.64 | 12.07 | 5.43 |
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
Base(MB) | After(MB) | Diff(MB) | ||
---|---|---|---|---|
Simple Label | 6.34 | 6.59 | 0.25 | |
Simple Label with Nilify | 6.46 | 6.48 | 0.02 | |
Attributed Label | 6.38 | 6.53 | 0.15 | |
Attributed Label with Nilify | 6.50 | 6.61 | 0.11 |
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
Base(MB) | After(MB) | Diff(MB) | ||
---|---|---|---|---|
Simple Label | 6.34 | 6.59 | 0.25 | |
Simple Label with Nilify | 6.46 | 6.48 | 0.02 | |
Cached Simple Label | 6.57 | 11.71 | 5.14 | |
Attributed Label | 6.38 | 6.53 | 0.15 | |
Attributed Label with Nilify | 6.50 | 6.61 | 0.11 | |
Cached Attributed Label | 6.64 | 12.07 | 5.43 | |
Image | 6.31 | 6.59 | 0.28 | |
Image with Nilify | 6.34 | 6.55 | 0.21 | |
Cached Image | 6.92 | 14.82 | 7.90 |
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
extension UIView { | |
func transparentPercentage() -> Double { | |
let width = Int(bounds.width) | |
let height = Int(bounds.height) | |
// 1. Prepare a memory space where you write in RGBA data of the view | |
var pixelData: [UInt8] = Array<UInt8>(repeating: 0, count: width * height * 4) | |
let colorSpace = CGColorSpaceCreateDeviceRGB() | |
let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedLast.rawValue) |
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
override func draw(_ rect: CGRect) { | |
super.draw(rect) | |
} | |
override func draw(_ layer: CALayer, in context: CGContext) { | |
super.draw(layer, in: context) | |
// 1. Let the subviews to render into the context | |
foregroundView?.layer.render(in: context) |
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 previousLocation: CGPoint? | |
// 0. Line/LineCollection class is a convenience class to store line(s) | |
private var lineCollection: LineCollection = LineCollection() | |
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) { | |
// 1. If there is no touch point or if the point did not move, ignore | |
guard let touch = touches.first else { | |
return | |
} | |
let location = touch.location(in: self) |
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 setupCatsSection() -> NSCollectionLayoutSection { | |
// 1. Configuring Section. Item -> Group -> Section | |
// Item | |
let item = NSCollectionLayoutItem( | |
layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), | |
heightDimension: .fractionalHeight(1.0))) | |
item.contentInsets = NSDirectionalEdgeInsets(top: 6.7, leading: 10.0, bottom: 6.7, trailing: 10.0) | |
// Group | |
let group = NSCollectionLayoutGroup.vertical( |
NewerOlder