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
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import PlaygroundSupport | |
class EdgeInsetLabel: UILabel { | |
private let textInsets: UIEdgeInsets | |
init(inset: UIEdgeInsets) { | |
textInsets = inset |
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: UserDefaults Extension | |
extension UserDefaults { | |
func getColors(key: String) -> [UIColor]? { | |
if let data = data(forKey: key) { | |
do { | |
if let color = try NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data) as? [UIColor] { | |
return color | |
} | |
} catch { | |
print("Error") |
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 SceneKit | |
import PlaygroundSupport | |
var sceneView = SCNView() | |
PlaygroundPage.current.liveView = sceneView | |
sceneView.backgroundColor = .black | |
var scene = SCNScene() | |
sceneView.scene = scene | |
var universe = scene.rootNode |
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
// Approach 1 - [https://stackoverflow.com/a/70492824/6576315] | |
struct Employee { | |
var name: String? | |
var designation: String? | |
func name(_ name: String) -> Employee { | |
.init(name: name, designation: self.designation) | |
} |
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
struct BaseModel : Codable { | |
let status : Status? | |
let data : Data? | |
enum CodingKeys: String, CodingKey { | |
case status = "status" | |
case data = "data" | |
} |
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 UIKit | |
import WebKit | |
class ViewController: UIViewController, WKNavigationDelegate, WKUIDelegate { | |
var loader: UIActivityIndicatorView! | |
@IBOutlet weak var webView: WKWebView! | |
override func viewDidLoad() { |
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 WebKit | |
class ViewController: UIViewController, WKNavigationDelegate { | |
@IBOutlet weak var webView: WKWebView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
webView.uiDelegate = self |
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
struct BaseModel : Codable { | |
let photos : Photos? | |
let stat : String? | |
enum CodingKeys: String, CodingKey { | |
case photos = "photos" | |
case stat = "stat" | |
} |
NewerOlder