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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
// | |
// Created by Dejan Skledar | |
// Equaleyes Solutions Ltd. | |
// | |
import UIKit | |
struct Sword: Codable { | |
private enum CodingKeys: String, CodingKey { |
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
guard let tabItems = tabBar.items else { return } | |
tabItems[0].titlePositionAdjustment = UIOffset(horizontal: -15, vertical: 0) | |
tabItems[1].titlePositionAdjustment = UIOffset(horizontal: 15, vertical: 0) |
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
middleButton.frame.size = CGSize(width: 70, height: 70) | |
middleButton.backgroundColor = .blue | |
middleButton.layer.cornerRadius = 35 | |
middleButton.layer.masksToBounds = true | |
middleButton.center = CGPoint(x: UIScreen.main.bounds.width / 2, y: | |
UIScreen.main.bounds.height - 40) | |
view.addSubview(middleButton) |
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
middleButton.center = CGPoint(x: tabBar.frame.width / 2, y: 10) | |
tabBar.addSubview(middleButton) |
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
typealias Codable = Decodable & Encodable |
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
protocol Encodable { | |
func encode(to encoder: Encoder) throws | |
} | |
protocol Decodable { | |
init(from decoder: Decoder) throws | |
} |
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
struct Sword: Codable { | |
let name: String | |
let size: Int | |
let isValyrianSteel: Bool | |
} |
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
let oathKeeper = Sword(name: "Oathkeeper", size: 120, isValyrianSteel: true) | |
let jsonData = try? JSONEncoder().encode(oathKeeper) |
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
{ | |
"name": "Oathkeeper", | |
"size": 120, | |
"isValyrianSteel": true | |
} |
OlderNewer