Skip to content

Instantly share code, notes, and snippets.

View codedeman's full-sized avatar
👋
Work Hard

Kevin codedeman

👋
Work Hard
View GitHub Profile
@codedeman
codedeman / Struct.swift
Last active April 24, 2024 16:07
Struct
struct Point {
let x: Double
let y: Double
}
var point1 = Point(x: 10, y: 20)
var point2 = point1 // Creates a copy of point1
point2.x = 30 // Modifying point2 doesn't affect point1
print(point1.x) // Output: 10
@codedeman
codedeman / MockMoviePresenter.swift
Last active September 20, 2022 02:07
MockMoviePresenter
class MockMoviePresenter:MoviePresenter {
var listMovie:[FilmModel] = []
var isCompleted = false
func didGetListMovie(listMovie: [FilmModel]) {
self.listMovie = listMovie
}
func success(){
self.isCompleted = true
}
func fail() {
@codedeman
codedeman / MockMovieInteractor.swift
Last active September 20, 2022 02:06
MockMovieInteractorTesting
class MockMovieInteractor:MovieInteractor {
var success = false
func performGetStatusRequest() {
if success {
self.viewModel.delegate?.success()
} else {
self.viewModel.delegate?.fail()
}
}
override func performGetListMovie() {
@codedeman
codedeman / MovieServiceApi.swift
Created September 12, 2022 01:39
MovieServiceApi
import Foundation
import Alamofire
class MoviveService {
static let instance = MoviveService()
func getListMovie(completion:@escaping(_ sucess:Bool, _ film:FilmData?)->Void) {
let url = "https://codedeman.github.io/ssd_api/fakeCinema.json"
AF.request(url).validate().responseJSON { response in
print("response +++++ --- \(response.result)")
do {
@codedeman
codedeman / CinemaViewController.swift
Created August 18, 2022 06:37
CinemaViewController
extension ViewController:CinemaCellDelegate {
func loadImageCompleted(index: Int) {
self.tableView.reloadRows(at: [IndexPath.init(row: index, section: 0)], with: .fade)
}
}
@codedeman
codedeman / CinemaCell.swift
Created July 30, 2022 01:30
DecorateView
override func awakeFromNib() {
super.awakeFromNib()
self.vMain.backgroundColor = .white
self.vBoard.layer.cornerRadius = 10
self.vBoard.clipsToBounds = true
self.vMain.layer.cornerRadius = 10
self.vMain.clipsToBounds = true
self.vMain.layer.borderColor = UIColor(red: 242/255, green: 242/255, blue: 242/255, alpha: 1).cgColor
self.vMain.layer.borderWidth = 1
self.lblTitle.textColor = .black
@codedeman
codedeman / CinemaCell.swift
Last active August 18, 2022 04:34
self-sizing-tableview
//
// CinemaListCell.swift
// AppLab
//
// Created by Pham Kien on 11.06.22.
//
import UIKit
import SDWebImage
{
"listFilms":[
{
"id":"12345",
"filmUrl":"https://www.cgv.vn/media/catalog/product/cache/1/image/1800x/71252117777b696995f01934522c402d/d/r/dr-strange-payoff-poster_1_.jpg",
"name":"Multiverse of madness",
"price":"100000",
"filmDes":"Doctor Strange teams up with a mysterious teenage girl from his dreams who can travel across multiverses, to battle multiple threats, including other-"
@codedeman
codedeman / scrollView
Created March 18, 2020 10:35
layoutwithcode
//
// HomeVC.swift
// Animation-Research
//
// Created by Ominext on 3/18/20.
// Copyright © 2020 Ominext. All rights reserved.
//
import UIKit
import SnapKit
{
"name": "Back-endAppTracking",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node src/index.js",
"dev": "nodemon src/index.js"
},
"keywords": [],