mirror of
https://github.com/insidegui/VirtualBuddy.git
synced 2026-12-06 06:30:11 +08:00
32 lines
821 B
Swift
32 lines
821 B
Swift
//
|
|
// VMConfigurationViewModel.swift
|
|
// VirtualUI
|
|
//
|
|
// Created by Guilherme Rambo on 18/07/22.
|
|
//
|
|
|
|
import SwiftUI
|
|
import VirtualCore
|
|
|
|
final class VMConfigurationViewModel: ObservableObject {
|
|
|
|
@Published var config: VBMacConfiguration {
|
|
didSet {
|
|
/// Reset display preset when changing display settings.
|
|
/// This is so the warning goes away, if any warning is being shown.
|
|
if config.hardware.displayDevices != oldValue.hardware.displayDevices,
|
|
config.hardware.displayDevices.first != selectedDisplayPreset?.device
|
|
{
|
|
selectedDisplayPreset = nil
|
|
}
|
|
}
|
|
}
|
|
|
|
@Published var selectedDisplayPreset: VBDisplayPreset?
|
|
|
|
init(config: VBMacConfiguration) {
|
|
self.config = config
|
|
}
|
|
|
|
}
|