Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Beacon: Hashable, Codable, Identifiable {
- var id: Int
- ...
- var beaconadv: BeaconAdv
- ...
- }
- struct BeaconAdv: Hashable, Codable {
- ...
- var booltest: Bool?
- ...
- }
- final class UserData: BindableObject {
- let willChange = PassthroughSubject<UserData, Never>()
- var showFavoritesOnly = false {
- willSet {
- willChange.send(self)
- }
- }
- var showOtherBeacons = true {
- didSet {
- willChange.send(self)
- }
- }
- var updateBeaconDetails = true {
- didSet {
- willChange.send(self)
- }
- }
- var beacons = beaconData {
- didSet {
- willChange.send(self)
- }
- }
- }
- let beaconData: [Beacon] = load("beaconDataTest.json")
- private var centralManager : CBCentralManager!
- private var locationManager : LocationManager!
- var userData: UserData!
- public func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
- struct BeaconDetail: View {
- @EnvironmentObject var userData: UserData
- ...
- var body: some View {
- VStack {
- List {
- Section() {
- if self.userData.beacons[self.beaconIndex].beaconadv.booltest != nil {
- if self.userData.beacons[self.beaconIndex].beaconadv.booltest! {
- Text("booltest = true")
- } else {
- Text("booltest = false")
- }
- } else {
- Text("booltest = nil")
- }
- }
- ...
- }
- ... .navigationBarTitle(Text(self.userData.beacons[self.beaconIndex].name), displayMode: .inline)
- .background(Color.white)
- .listStyle(.grouped)
- }
- }
- Thread 1: EXC_BREAKPOINT (code=1, subcode=0x1d3b0b690)
- @UIApplicationMain
- class AppDelegate: UIResponder, UIApplicationDelegate {
- func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
- // Override point for customization after application launch.
- return true
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement