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
// Hitendra Solanki | |
// SwiftUI Coin Flip Example | |
//Represents the FRONT view for the coint | |
struct CoinViewFront: View { | |
var body: some View { | |
Image("front") | |
.resizable() | |
} | |
} |
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
// Hitendra Solanki | |
// Adapter design pattern Playground example | |
import Foundation | |
class Point { | |
var x: Int | |
var y: Int | |
init(x: Int, y: Int) { |
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
// Hitendra Solanki | |
// Adapter design pattern Playground example | |
import Foundation | |
class Point { | |
var x: Int | |
var y: Int | |
init(x: Int, y: Int) { |
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
// | |
// StudentTableViewCell.swift | |
// HSUndoRedoTutorial1 | |
// | |
// Created by Hitendra on 18/04/19. | |
// Copyright © 2019 Hitendra iDev. All rights reserved. | |
// | |
import UIKit | |
class StudentTableViewCell: UITableViewCell { |
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
// | |
// Student.swift | |
// HSUndoRedoTutorial1 | |
// | |
// Created by Hitendra on 18/04/19. | |
// Copyright © 2019 Hitendra iDev. All rights reserved. | |
// | |
import Foundation | |
struct Student { |
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
// | |
// StudentsListViewController.swift | |
// HSUndoRedoTutorial1 | |
// | |
// Created by Hitendra on 18/04/19. | |
// Copyright © 2019 Hitendra iDev. All rights reserved. | |
// | |
import UIKit |
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
// Hitendra Solanki | |
// Semi-singleton design pattern Playground example | |
//In semi-singleton design pattern, marking the class as final is optional | |
final class LogManager { | |
//shared object | |
static let logger: LogManager = LogManager(databaseURLEndpoint: "https://www.hitendrasolanki.com/logger/live") | |
private var databaseURLEndpoint: String | |
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
// Hitendra Solanki | |
// Pure-singleton design pattern Playground example | |
final class LogManager { | |
//shared and only one available object | |
static let logger: LogManager = LogManager(databaseURLEndpoint: "https://www.hitendrasolanki.com/logger/live") | |
private var databaseURLEndpoint: String | |
//marked as private, no one is allowed to access this initialiser outside of the class |
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
//This is function in playground which executes our test code | |
func main() { | |
var hitendra = Person() //person with empty details | |
let personBuilder = PersonBuilder(person: hitendra) | |
hitendra = personBuilder | |
.personalInfo | |
.nameIs("Hitendra Solanki") | |
.genderIs("Male") |
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
class Person { | |
//personal details | |
var name: String = "" | |
var gender: String = "" | |
var birthDate: String = "" | |
var birthPlace: String = "" | |
var height: String = "" | |
var weight: String = "" | |
//contact details |
NewerOlder