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
// Singleton Design Pattern Example | |
// Author: Jean-Marc Boullianne | |
class Singleton { | |
static let instance = Singleton() | |
private init() { | |
// Initialize class variable here | |
} |
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
// Observer pattern in Swift | |
// Author: Jean-Marc Boullianne | |
class Subject<T> { | |
var val:T { | |
didSet { | |
notifyObservers() | |
} | |
} |
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
// | |
// STSegmentedView.swift | |
// | |
// | |
// Created by Jean-Marc Boullianne on 6/16/19. | |
// Copyright © 2019 Jean-Marc Boullianne. All rights reserved. | |
// | |
import UIKit |
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 SwiftUI | |
struct PowerToggleStyle: ToggleStyle { | |
func makeBody(configuration: Configuration) -> some View { | |
HStack { | |
configuration.label | |
Spacer() | |
Rectangle() | |
.foregroundColor(configuration.isOn ? .green : .gray) |
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
// | |
// SheetBase.swift | |
// PopoverSheet_Tests | |
// | |
// Created by Jean-Marc Boullianne on 9/13/20. | |
// Copyright © 2020 TrailingClosure. All rights reserved. | |
// | |
import SwiftUI |
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
// | |
// ContentView.swift | |
// ScrollView_Tests | |
// | |
// Created by Jean-Marc Boullianne on 7/30/20. | |
// | |
import SwiftUI | |
struct ContentView: View { |
OlderNewer