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 Foundation | |
import SwiftUI | |
import Combine | |
// MARK: - Presentation Layer | |
struct MyView: View { | |
@ObservedObject var viewModel: MyViewModel | |
var body: some View { |
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 Foundation | |
import SwiftUI | |
import Combine | |
protocol Networking { | |
func fetch() -> String? | |
} | |
class NetworkManager: Networking { | |
// Some code for making network requests | |
func fetch() -> 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 Foundation | |
import SwiftUI | |
import Combine | |
// MARK: - Presentation Layer | |
struct MyView: View { | |
@ObservedObject var viewModel: MyViewModel | |
var body: some View { |
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
السلام عليكم ، هذا كود ريجيكس بسيط للتحقق من صحة أرقام الجوالات التونسية ، يقوم الريجيكس بالتحقق من مفتاح الدولة ، مفتاح شركة الإتصالات لضمان صحة النص المدخل . | |
Hello, this is a simple regex to validate tunisian mobile numbers, the code will validate country code, telecome company code and make sure the tested sting is correct . | |
"^(00216|216|\+216)(9|5|4|2)([0-9]{7})$" | |
Regex Breakdown - شرح الكود | |
----- |
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
// | |
// View.swift | |
// iOSDiffableDataSource | |
// | |
// Created by Ghazi Tozri on 9/1/2021. | |
// | |
import UIKit | |
import Combine |
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
//MARK: - Observers | |
extension MainView | |
{ | |
func setupObservers() | |
{ | |
// MONITOR search bar textfield keystrokes | |
$keyStroke | |
.receive(on: RunLoop.main) | |
.sink { (keyWordValue) in | |
print(keyWordValue) |
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 | |
import Combine | |
class ViewModel | |
{ | |
var cancellables: Set<AnyCancellable> = [] | |
init() | |
{ | |
$keyWordSearch.receive(on: RunLoop.main).debounce(for: .seconds(0.5), scheduler: RunLoop.main) |
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 Service | |
{ | |
let API_KEY = "k_0hpcd8sn" | |
let endpoint = "https://imdb-api.com/en/API/SearchMovie/" | |
static var sharedInstance = Service() | |
private init(){} | |
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 | |
import Combine | |
class ViewModel | |
{ | |
var cancellables: Set<AnyCancellable> = [] | |
init() | |
{ | |
$keyWordSearch |
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 | |
import Combine | |
class MoviesTableViewDiffableDataSource: UITableViewDiffableDataSource<String?, Result> {} | |
class MainView: UIViewController | |
{ | |
var cancellables: Set<AnyCancellable> = [] | |
@IBOutlet weak var searchBar: UISearchBar! |