Skip to content

Commit d44765a

Browse files
committed
Update method naming to follow Swift 3 guidelines
1 parent 5b50bf1 commit d44765a

File tree

9 files changed

+26
-26
lines changed

9 files changed

+26
-26
lines changed

iCookTV/Extensions/UIFont+TV.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,50 +35,50 @@ extension UIFont {
3535

3636
// MARK: - Private Methods
3737

38-
private class func tvFontOfSize(_ fontSize: CGFloat) -> UIFont {
38+
private class func tvFont(ofSize fontSize: CGFloat) -> UIFont {
3939
return UIFont(name: FontFamily.PingFangTCRegular, size: fontSize) ?? UIFont.systemFont(ofSize: fontSize)
4040
}
4141

42-
private class func tvBoldFontOfSize(_ fontSize: CGFloat) -> UIFont {
42+
private class func tvBoldFont(ofSize fontSize: CGFloat) -> UIFont {
4343
return UIFont(name: FontFamily.PingFangTCMedium, size: fontSize) ?? UIFont.boldSystemFont(ofSize: fontSize)
4444
}
4545

4646
// MARK: - Public Methods
4747

4848
class func tvFontForTagline() -> UIFont {
49-
return UIFont.tvFontOfSize(44)
49+
return UIFont.tvFont(ofSize: 44)
5050
}
5151

5252
class func tvFontForCategoryCell() -> UIFont {
53-
return UIFont.tvFontOfSize(35)
53+
return UIFont.tvFont(ofSize: 35)
5454
}
5555

5656
class func tvFontForFocusedCategoryCell() -> UIFont {
57-
return UIFont.tvFontOfSize(40)
57+
return UIFont.tvFont(ofSize: 40)
5858
}
5959

6060
class func tvFontForVideoCell() -> UIFont {
61-
return UIFont.tvFontOfSize(29)
61+
return UIFont.tvFont(ofSize: 29)
6262
}
6363

6464
class func tvFontForFocusedVideoCell() -> UIFont {
65-
return UIFont.tvBoldFontOfSize(29)
65+
return UIFont.tvBoldFont(ofSize: 29)
6666
}
6767

6868
class func tvFontForVideoLength() -> UIFont {
6969
return UIFont.systemFont(ofSize: 20)
7070
}
7171

7272
class func tvFontForLogo() -> UIFont {
73-
return UIFont.tvFontOfSize(65)
73+
return UIFont.tvFont(ofSize: 65)
7474
}
7575

7676
class func tvFontForMenuButton() -> UIFont {
77-
return UIFont.tvFontOfSize(30)
77+
return UIFont.tvFont(ofSize: 30)
7878
}
7979

8080
class func tvFontForHeaderTitle() -> UIFont {
81-
return UIFont.tvFontOfSize(35)
81+
return UIFont.tvFont(ofSize: 35)
8282
}
8383

8484
}

iCookTV/Extensions/UIImage+Grid.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ extension UIImage {
4343
return newImage
4444
}
4545

46-
class func placeholderImage(withSize size: CGSize) -> UIImage? {
46+
class func placeholderImage(with size: CGSize) -> UIImage? {
4747
let layer = CAGradientLayer()
4848
layer.frame = CGRect(origin: CGPoint.zero, size: size)
4949
layer.colors = [UIColor.white.cgColor, UIColor.Palette.LightGray.cgColor]
@@ -63,7 +63,7 @@ extension UIImage {
6363
return image
6464
}
6565

66-
class func resizableImage(withFillColor color: UIColor) -> UIImage? {
66+
class func resizableImage(filledWith color: UIColor) -> UIImage? {
6767
UIGraphicsBeginImageContextWithOptions(CGSize(width: 1, height: 1), true, 0)
6868

6969
color.setFill()

iCookTV/Helpers/CoverBuilder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class CoverBuilder {
6565
if let currentImage = self?.cover, currentImage.size == imageSize {
6666
canvas = currentImage
6767
} else {
68-
canvas = UIImage.placeholderImage(withSize: imageSize)
68+
canvas = UIImage.placeholderImage(with: imageSize)
6969
}
7070

7171
let cover = canvas?.image(byReplacingImage: image, in: grid)

iCookTV/Models/CategoriesDataSource.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class CategoriesDataSource: DataSource<CategoriesCollection> {
3838

3939
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
4040
let cell = collectionView.dequeueReusableCell(for: indexPath) as CategoryCell
41-
cell.configure(withCategory: dataCollection[indexPath.row])
41+
cell.configure(with: dataCollection[indexPath.row])
4242
return cell
4343
}
4444

iCookTV/Models/VideosDataSource.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class VideosDataSource: DataSource<VideosCollection> {
5050

5151
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
5252
let cell = collectionView.dequeueReusableCell(for: indexPath) as VideoCell
53-
cell.configure(withVideo: dataCollection[indexPath.row])
53+
cell.configure(with: dataCollection[indexPath.row])
5454
return cell
5555
}
5656

iCookTV/Views/CategoryCell.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class CategoryCell: UICollectionViewCell {
3737

3838
private(set) lazy var imageView: UIImageView = {
3939
let _imageView = UIImageView()
40-
_imageView.image = UIImage.placeholderImage(withSize: self.bounds.size)
40+
_imageView.image = UIImage.placeholderImage(with: self.bounds.size)
4141
_imageView.contentMode = .scaleAspectFill
4242
return _imageView
4343
}()
@@ -75,7 +75,7 @@ class CategoryCell: UICollectionViewCell {
7575
tasks[index] = nil
7676
}
7777
coverBuilder.resetCover()
78-
imageView.image = UIImage.placeholderImage(withSize: bounds.size)
78+
imageView.image = UIImage.placeholderImage(with: bounds.size)
7979
textLabel.text = nil
8080
}
8181

@@ -153,7 +153,7 @@ class CategoryCell: UICollectionViewCell {
153153

154154
// MARK: - Public Methods
155155

156-
func configure(withCategory category: Category) {
156+
func configure(with category: Category) {
157157
textLabel.text = category.name
158158

159159
if let cached = coverBuilder.coverForCategory(withID: category.id) {

iCookTV/Views/EmptyStateView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ class EmptyStateView: UIView {
6767

6868
imageView.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true
6969

70-
let views = [
70+
let views: [String: Any] = [
7171
"image": imageView,
7272
"text": textLabel
73-
] as [String : Any]
73+
]
7474
addConstraints(NSLayoutConstraint.constraints(
7575
withVisualFormat: "H:|-(>=0)-[image(280)]-(>=0)-|",
7676
options: [],

iCookTV/Views/MenuButton.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class MenuButton: UIButton {
4444
contentEdgeInsets = UIEdgeInsets(top: 15, left: 40, bottom: 15, right: 40)
4545
setTitleColor(UIColor.Palette.Button.TitleColor, for: UIControlState())
4646
setTitleColor(UIColor.Palette.FocusedButton.TitleColor, for: .focused)
47-
setImage(UIImage.resizableImage(withFillColor: UIColor.Palette.Button.BackgroundColor), for: .normal)
48-
setImage(UIImage.resizableImage(withFillColor: UIColor.Palette.FocusedButton.BackgroundColor), for: .focused)
47+
setImage(UIImage.resizableImage(filledWith: UIColor.Palette.Button.BackgroundColor), for: .normal)
48+
setImage(UIImage.resizableImage(filledWith: UIColor.Palette.FocusedButton.BackgroundColor), for: .focused)
4949
}
5050

5151
}

iCookTV/Views/VideoCell.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class VideoCell: UICollectionViewCell {
3131

3232
private(set) lazy var imageView: UIImageView = {
3333
let _imageView = UIImageView()
34-
_imageView.image = UIImage.placeholderImage(withSize: self.bounds.size)
34+
_imageView.image = UIImage.placeholderImage(with: self.bounds.size)
3535
_imageView.contentMode = .scaleAspectFill
3636
return _imageView
3737
}()
@@ -79,7 +79,7 @@ class VideoCell: UICollectionViewCell {
7979
override func prepareForReuse() {
8080
super.prepareForReuse()
8181
imageView.kf.cancelDownloadTask()
82-
imageView.image = UIImage.placeholderImage(withSize: bounds.size)
82+
imageView.image = UIImage.placeholderImage(with: bounds.size)
8383
titleLabel.text = nil
8484
}
8585

@@ -138,9 +138,9 @@ class VideoCell: UICollectionViewCell {
138138

139139
// MARK: - Public Methods
140140

141-
func configure(withVideo video: Video) {
141+
func configure(with video: Video) {
142142
if let url = video.coverURL {
143-
imageView.kf.setImage(with: url, placeholder: UIImage.placeholderImage(withSize: bounds.size))
143+
imageView.kf.setImage(with: url, placeholder: UIImage.placeholderImage(with: bounds.size))
144144
}
145145
titleLabel.text = video.title
146146
timeLabel.text = video.timestamp

0 commit comments

Comments
 (0)