This file contains 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 Combine | |
import Foundation | |
import XCTest | |
class LocalFileSystemLoader { | |
typealias LoadResult = Result<Data?, Error> | |
private let url: URL | |
init(url: URL) { | |
self.url = url |
This file contains 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 Combine | |
import Foundation | |
import UIKit | |
class PubisherFactory { | |
func make() -> AnyPublisher<String, Error> { | |
let localCache = LocalCache() | |
return localCache | |
.makeAnyCachePublisher() |
This file contains 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 ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let textLayer = makeTextLayer() | |
let animation = makeTextLayerAnimation() | |
view.layer.addSublayer(textLayer) |
This file contains 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 PlaygroundSupport | |
import UIKit | |
class Subclase: UIView { | |
var bezierPath: UIBezierPath? | |
override func draw(_ rect: CGRect) { | |
// let figura = dibujaRectangulo(altura: 200, ancho: 100) | |
// let figura = dibujaCirculo(ancho: 100, altura: 100) | |
// let figura = dibujaTriangulo() |
This file contains 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 | |
// Instead of having matrices of Student data, it's better to have the logic divided in structs | |
struct Student { | |
let subjects: [Subject] | |
let tests: [Test] | |
} | |
struct Subject { |
This file contains 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 UIKit | |
import AppKit | |
struct ColorTheme { | |
let name: NSColor | |
let lastName: NSColor | |
} | |
let colorTheme = ColorTheme(name: .red, lastName: .yellow) |
This file contains 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 WebKit | |
class ViewController: UIViewController { | |
lazy var webView: WKWebView = { | |
let mySVGImage = "<svg height=\"190\"><polygon points=\"100,10 40,180 190,60 10,60 160,180\" style=\"fill:lime;stroke:purple;stroke-width:5;fill-rule:evenodd;\"></svg>" | |
let preferences = WKPreferences() | |
preferences.javaScriptEnabled = false | |
let configuration = WKWebViewConfiguration() |
This file contains 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
private class func webPImage(from data: NSData) -> UIImage? { | |
var width: Int32 = 0 | |
var height: Int32 = 0 | |
var config = WebPDecoderConfig() | |
guard | |
WebPGetInfo(data.bytes.assumingMemoryBound(to: UInt8.self), data.length, &width, &height) > 0, | |
WebPInitDecoderConfig(&config) != 0 | |
else { | |
return nil |
This file contains 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 ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { | |
var tableView: UITableView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
tableView = UITableView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.height)) | |
tableView.register(MyCell.self, forCellReuseIdentifier: "cell") |
This file contains 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
{ | |
"Altavista": { | |
"apartamento": "20", | |
"casa": "34", | |
"comunas": {} | |
}, | |
"Barbosa": { | |
"apartamento": "2500000", | |
"casa": "1200000", | |
"comunas": {} |
NewerOlder