SwiftUI – StateObject in parent view is unavailable in child view model
// In my root view aka Parent View import SwiftUI struct RootView: View { @StateObject private var devices = DevicesViewModel() var body: some View { ScrollView { UnitStatusCard(devicesVM: devices) } .onAppear() { devices.fetchDevices() } } } // DeviceViewModel.swift – Parent View Model import Foundation class DevicesViewModel: ObservableObject { @Published var models: [Device] = [] private […]
SwiftUI – StateObject in parent view is unavailable in child view model
// In my root view aka Parent View import SwiftUI struct RootView: View { @StateObject private var devices = DevicesViewModel() var body: some View { ScrollView { UnitStatusCard(devicesVM: devices) } .onAppear() { devices.fetchDevices() } } } // DeviceViewModel.swift – Parent View Model import Foundation class DevicesViewModel: ObservableObject { @Published var models: [Device] = [] private […]
Creating a Two Page Book using UIPageViewController in Swift
I’m trying to implement a book like interface in my swift app where the spine of the book is at the centre and the user is able to view two pages. For this, I’m using the UIPageViewController class and creating an array of ViewControllers to be displayed on the screen.
Creating a Two Page Book using UIPageViewController in Swift
I’m trying to implement a book like interface in my swift app where the spine of the book is at the centre and the user is able to view two pages. For this, I’m using the UIPageViewController class and creating an array of ViewControllers to be displayed on the screen.
SwiftUI YouTube Transcript API
I want some way to get the transcript of a YouTube video in SwiftUI with an API.
Draw a straight line between 2 circles in SwiftUI
I’ve been trying different ways of drawing a line between 2 circles(first and second circle) in SwiftUI.