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 { | |
| /// For converting Hex-based colors | |
| convenience init(hex: String) { | |
| var hexSanitized = hex.trimmingCharacters(in: .whitespacesAndNewlines) | |
| hexSanitized = hexSanitized.replacingOccurrences(of: "#", with: "") | |
| var rgb: UInt64 = 0 | |
| var r: CGFloat = 0.0 |
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 { | |
| /// For converting Hex-based colors | |
| convenience init(hex: String) { | |
| var hexSanitized = hex.trimmingCharacters(in: .whitespacesAndNewlines) | |
| hexSanitized = hexSanitized.replacingOccurrences(of: "#", with: "") | |
| var rgb: UInt64 = 0 | |
| var r: CGFloat = 0.0 |
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 SwiftUI | |
| extension Color { | |
| init(hex: String) { | |
| self.init(UIColor(hex: hex)) | |
| } | |
| } | |
| extension UIColor { |
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
| <key>UIAppFonts</key> | |
| <array> | |
| <string>Montserrat-Bold.ttf</string> | |
| <string>Montserrat-Italic.ttf</string> | |
| <string>Montserrat-Medium.ttf</string> | |
| <string>Montserrat-MediumItalic.ttf</string> | |
| <string>Montserrat-Regular.ttf</string> | |
| <string>Montserrat-SemiBold.ttf</string> | |
| <string>Montserrat-SemiBoldItalic.ttf</string> | |
| <string>Montserrat-Thin.ttf</string> |
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 SwiftUI | |
| enum Montserrat { | |
| case thin | |
| case thinItalic | |
| case regular | |
| case italic | |
| case medium | |
| case mediumItalic | |
| case semibold |
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 SwiftUI | |
| extension Color { | |
| init(hex: String) { | |
| self.init(UIColor(hex: hex)) | |
| } | |
| static func randomColor() -> Color { | |
| return Color(UIColor.random()) |
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 | |
| @main | |
| class AppDelegate: UIResponder, UIApplicationDelegate { | |
| // MARK:- variables | |
| var window: UIWindow? | |
| // MARK:- functions‹ | |
| func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { |
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 HomeViewController: UITableViewDelegate, UITableViewDataSource { | |
| func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
| guard let pokemons = self.homeViewModel.filteredPokemons.value else { return 0 } | |
| print("new count", pokemons.count) | |
| return pokemons.count | |
| } | |
| func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | |
| return PokemonTableViewCell().cellHeight | |
| } |
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 HomeViewController: UISearchBarDelegate { | |
| func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) { | |
| searchBar.setShowsCancelButton(true, animated: true) | |
| self.homeViewModel.searchPokemons(with: searchText) | |
| } | |
| func searchBarCancelButtonClicked(_ searchBar: UISearchBar) { | |
| self.homeViewModel.resetData() | |
| self.searchBar.text = "" |
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 | |
| class HomeViewController: UIViewController { | |
| // MARK:- outlets | |
| @IBOutlet weak var pokemonTableView: UITableView! | |
| // MARK:- variables | |
| var homeViewModel: HomeViewModel! | |