View swift_design_patterns_singleton.swift
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 | |
} |
View swift_design_patterns_observer.swift
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() | |
} | |
} |
View STSegmentedView.swift
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 |
View PowerToggleStyle.swift
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) |
View SlidingSheetModifier.swift
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 |
View ScrollingHStackModifier_Example.swift
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