Skip to content

Commit

Permalink
genre view refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
cavaevinci committed Apr 1, 2024
1 parent 29a9b8d commit 258b31a
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 18 deletions.
4 changes: 4 additions & 0 deletions Gamester.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
3F4F85512BBB001A001188A1 /* UIColor+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F4F85502BBB001A001188A1 /* UIColor+Extension.swift */; };
3F580CB42B867F3200E4FE70 /* PinterestLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F580CB32B867F3200E4FE70 /* PinterestLayout.swift */; };
3F7B5D7A2BA2327100A1CEAE /* GenreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F7B5D792BA2327100A1CEAE /* GenreTests.swift */; };
3F7B5D7C2BA2328200A1CEAE /* GameTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F7B5D7B2BA2328200A1CEAE /* GameTests.swift */; };
Expand Down Expand Up @@ -73,6 +74,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
3F4F85502BBB001A001188A1 /* UIColor+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+Extension.swift"; sourceTree = "<group>"; };
3F580CB32B867F3200E4FE70 /* PinterestLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinterestLayout.swift; sourceTree = "<group>"; };
3F7B5D792BA2327100A1CEAE /* GenreTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenreTests.swift; sourceTree = "<group>"; };
3F7B5D7B2BA2328200A1CEAE /* GameTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -335,6 +337,7 @@
children = (
3FD644002B8250E900D2F586 /* UINavigationController+Extension.swift */,
3FB4DC072B87C81700FD8E1B /* String+Extension.swift */,
3F4F85502BBB001A001188A1 /* UIColor+Extension.swift */,
);
path = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -515,6 +518,7 @@
3FB4BE382BA2620100C9BB79 /* MockAPIService.swift in Sources */,
3FD643F52B7FB64400D2F586 /* GamesViewModel.swift in Sources */,
3FD643A92B7D3BF200D2F586 /* AppDelegate.swift in Sources */,
3F4F85512BBB001A001188A1 /* UIColor+Extension.swift in Sources */,
3FD643AB2B7D3BF200D2F586 /* SceneDelegate.swift in Sources */,
3FD644012B8250EA00D2F586 /* UINavigationController+Extension.swift in Sources */,
3FD643E92B7F7E8400D2F586 /* GameDetailsController.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"originHash" : "d2556eed6d59c2919206e22281751716bf9bf87b4ea396f687e4833a904dc30f",
"originHash" : "9f0f1cf2df8e723c4ac39893cf7f042b4aa4939af71fe4eb6c208335efb9a7f8",
"pins" : [
{
"identity" : "abseil-cpp-binary",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/abseil-cpp-binary.git",
"state" : {
"revision" : "df308b8b46607675f2b9ec8e569109008f9155ce",
"version" : "1.2022062300.1"
"revision" : "7ce7be095bc3ed3c98b009532fe2d7698c132614",
"version" : "1.2024011601.0"
}
},
{
Expand All @@ -24,17 +24,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/firebase-ios-sdk",
"state" : {
"revision" : "be49849dcba96f2b5ee550d4eceb2c0fa27dade4",
"version" : "10.22.1"
"revision" : "888f0b6026e2441a69e3ee2ad5293c7a92031e62",
"version" : "10.23.1"
}
},
{
"identity" : "googleappmeasurement",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleAppMeasurement.git",
"state" : {
"revision" : "482cfa4e5880f0a29f66ecfd60c5a62af28bd1f0",
"version" : "10.22.1"
"revision" : "c7a5917ebe48d69f421aadf154ef3969c8b7f12d",
"version" : "10.23.1"
}
},
{
Expand All @@ -60,17 +60,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/grpc-binary.git",
"state" : {
"revision" : "ea4cb5cc0c39c732b85386263116d2e2fdbbdc61",
"version" : "1.49.2"
"revision" : "67043f6389d0e28b38fa02d1c6952afeb04d807f",
"version" : "1.62.1"
}
},
{
"identity" : "gtm-session-fetcher",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/gtm-session-fetcher.git",
"state" : {
"revision" : "76135c9f4e1ac85459d5fec61b6f76ac47ab3a4c",
"version" : "3.3.1"
"revision" : "9534039303015a84837090d20fa21cae6e5eadb6",
"version" : "3.3.2"
}
},
{
Expand Down Expand Up @@ -114,17 +114,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/SDWebImage/SDWebImage",
"state" : {
"revision" : "b11493f76481dff17ac8f45274a6b698ba0d3af5",
"version" : "5.18.11"
"revision" : "f6afa0132961d593f07970d84e2d8b588c29ea04",
"version" : "5.19.1"
}
},
{
"identity" : "swift-protobuf",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-protobuf.git",
"state" : {
"revision" : "65e8f29b2d63c4e38e736b25c27b83e012159be8",
"version" : "1.25.2"
"revision" : "9f0c76544701845ad98716f3f6a774a892152bcb",
"version" : "1.26.0"
}
},
{
Expand Down
Binary file not shown.
3 changes: 1 addition & 2 deletions Gamester/Controllers/GenresController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class GenresController: UIViewController {
// MARK: UI Components
private var tableView: UITableView = {
let tv = UITableView()
tv.backgroundColor = .systemBackground
tv.backgroundColor = UIColor(hex: "#101118")
tv.register(GenreCell.self, forCellReuseIdentifier: GenreCell.identifier)
return tv
}()
Expand Down Expand Up @@ -59,7 +59,6 @@ class GenresController: UIViewController {
// MARK: UI Setup
private func setupUI() {
self.navigationItem.title = "Genres"
self.view.backgroundColor = .black
self.view.addSubview(tableView)
self.tableView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
Expand Down
26 changes: 26 additions & 0 deletions Gamester/Extensions/UIColor+Extension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// UIColor+Extension.swift
// Gamester
//
// Created by Nino on 01.04.2024..
//

import UIKit

extension UIColor {
convenience init(hex: String, alpha: CGFloat = 1.0) {
var formattedHex = hex
if hex.hasPrefix("#") {
formattedHex = String(hex.dropFirst())
}

var rgbValue: UInt64 = 0
Scanner(string: formattedHex).scanHexInt64(&rgbValue)

let red = CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0
let green = CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0
let blue = CGFloat(rgbValue & 0x0000FF) / 255.0

self.init(red: red, green: green, blue: blue, alpha: alpha)
}
}
2 changes: 1 addition & 1 deletion Gamester/Views/TableViewCells/GenreCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class GenreCell: UITableViewCell {
if isSelected {
self.contentView.backgroundColor = .systemGray
} else {
self.contentView.backgroundColor = .black
self.contentView.backgroundColor = UIColor(hex: "#101118")
}
self.genreName.text = genre.name
self.genreImage.sd_setImage(with: URL(string: genre.imageBackground))
Expand Down

0 comments on commit 258b31a

Please sign in to comment.