Skip to content

Instantly share code, notes, and snippets.

View metin-atalay's full-sized avatar

Metin Atalay metin-atalay

View GitHub Profile
@metin-atalay
metin-atalay / ScrollViewRTL.swift
Created August 10, 2022 14:14
SwiftUI RTL ScrollView
import SwiftUI
struct ScrollViewRTL<Content: View>: View {
@ViewBuilder var content: Content
@Environment(\.layoutDirection) private var layoutDirection
var type: RowType
init(type: RowType, @ViewBuilder content: () -> Content) {
self.type = type
self.content = content()
//
// RequestProvider.swift
// Requet Provider
//
// Created by Metin Atalay on 9.04.2022.
//
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
import Foundation
import UIKit
class WeatherListWireFrame: WeatherListWireFrameProtocol {
class func createWeatherListModule() -> UIViewController {
let navController = mainStoryboard.instantiateViewController(withIdentifier: "WeathersNavigationController")
if let view = navController.childViewControllers.first as? WeatherListViewController {
let presenter: WeatherListPresenterProtocol & WeatherListInteractorOutputProtocol = WeatherListPresenter()
let interactor: WeatherListInteractorInputProtocol & WeatherListRemoteDataManagerOutputProtocol = WeatherListInteractor()
let remoteDataManager: WeatherListRemoteDataManagerInputProtocol = WeatherListRemoteDataManager()
import Foundation
class WeatherListInteractor: WeatherListInteractorInputProtocol {
weak var presenter: WeatherListInteractorOutputProtocol?
var remoteDatamanager: WeatherListRemoteDataManagerInputProtocol?
func retrieveWeatherList(cityName: String) {
do {
remoteDatamanager?.retrieveWeatherList(cityName: cityName)
} catch {
class WeatherListPresenter: WeatherListPresenterProtocol {
weak var view: WeatherListViewProtocol?
var interactor: WeatherListInteractorInputProtocol?
var wireFrame: WeatherListWireFrameProtocol?
func viewDidLoad(cityName: String) {
view?.showLoading()
interactor?.retrieveWeatherList(cityName: cityName)
}
}
import UIKit
import PKHUD
class WeatherListViewController: UIViewController {
@IBOutlet weak var tableView: UITableView!
var presenter: WeatherListPresenterProtocol?
var weatherList: [WeatherModel] = []
import Foundation
import UIKit
protocol WeatherListViewProtocol: class {
var presenter: WeatherListPresenterProtocol? { get set }
// PRESENTER -> VIEW
func showWeatherInfo(weathers: WeatherModel)
func showError()
import Foundation
import ObjectMapper
struct WeatherModel : Mappable {
var coord : Coord?
var weather : [Weather]?
var base : String?
var main : Main?
var visibility : Int?
var wind : Wind?