mirror of
https://github.com/jeremysrand/ListenerApp.git
synced 2024-06-01 07:41:59 +00:00
31 lines
638 B
Swift
31 lines
638 B
Swift
//
|
|
// GSDestinations.swift
|
|
// ListenerGS
|
|
//
|
|
// Created by Jeremy Rand on 2021-10-19.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
|
|
struct Destination: Identifiable, Hashable {
|
|
let ipAddress : String
|
|
let id = UUID()
|
|
}
|
|
|
|
class GSDestinations : ObservableObject {
|
|
@Published var dests:[Destination] = []
|
|
|
|
public func onDelete(offsets: IndexSet) {
|
|
dests.remove(atOffsets: offsets)
|
|
}
|
|
|
|
public func onMove(source: IndexSet, destination: Int) {
|
|
dests.move(fromOffsets: source, toOffset: destination)
|
|
}
|
|
|
|
public func onAdd(ipAddress: String) {
|
|
dests.append(Destination(ipAddress: ipAddress))
|
|
}
|
|
}
|