Post

Replies

Boosts

Views

Activity

Swift package manager
I have an Xcode project that generates xyz.framework and that framework is used by other teams for their app. Updating the framework is a manual process. So I am planning to covert my xyz.framwork source to swift package manager. I couldn't find any such articles. Please let me know if there is any resource around this topic.
0
0
439
Apr ’21
How to present a view with modal animation programmatically
I have a framework that will be consumed by other developers to develop the app. I designed a view using SwiftUI in that framework and wanted to present that view with model animation programatically from the framework. There are many sample that shows how to present a view with modal animation associated with button tap. Can anyone let me know how to present a view modal programmatically?
0
0
430
Jul ’21
Data from Swift Enum to SwiftUI
I have a class written in Swift that will present the view developed using SwiftUI. SwiftUI is dependent on the enum used in Swift class to render the UI. Is there a way to bind that enum in Swift UI so that SwiftUI will update automatically when ever there is a change to the enum in Swift class
0
1
612
Jul ’21
Passing delegate/protocol as function parameter
public protocol UploadDelegate: AnyObject {} class NetworkManager: UploadDelegate {} class A { B().abc(uploadDelegate:NetworkManager() ) } class B { func abc (uploadDelegate: UploadDelegate) { C().efg(uploadDelegate:uploadDelegate ) } } class C { func efg (uploadDelegate: UploadDelegate) { D().hij(uploadDelegate:uploadDelegate ) } } class D { func hij (uploadDelegate: UploadDelegate) { uploadDelegate.func() } } Can we pass the protocol/delegate as a func parameter? If yes, I believe its a weak property.
0
0
506
Jul ’21
Passing Data to ViewModal
class A { func processData { let viewModel: ViewModal = ViewModal() let viewController = ViewController() viewController.displayUI(viewModel) .... .... .... .... viewModel.imageName = "abcd" .... .... .... .... viewModel.imageName = "efg" .... .... .... .... viewModel.imageName = "hij" } } class ViewController { func displayUI (viewModal: ViewModal){ let contentView = ContentView(viewModal: viewModal).environmentObject(self) // present contentView } } class ViewModal { @Published var imageName: String = ""   @Published var label: String = "" // string formatting } struct ContentView: View {  @State var viewModel: ViewModal  @EnvironmentObject var viewController: ViewController  var body: some View { } } Can class A directly access ViewModal or it should pass the data to ViewController and ViewController set the data in ViewModal
0
0
834
Jul ’21
Cannot convert value of type 'some View' to specified type ‘ContentView'
func displayUI () { let hostingController = UIHostingController(rootView: ContentView(ViewModel: contentViewModal).environmentObject(self)) } Above code works fine. I attempted to make the hostingController as instance variable instead of local variable and declared the hostingController outside of display function like this lazy var hostingController: UIHostingController = UIHostingController(rootView: ContentView()) and so I removed let keyword func displayUI () {  hostingController = UIHostingController(rootView: ContentView(ViewModel: contentViewModal).environmentObject(self)) } Once I remove the let keyword I started getting this error. Cannot convert value of type 'some View' to specified type ‘ContentView' Any idea why I am getting this error after removing let keyword declared before hostingController variable?
0
0
710
Aug ’21
Framework split
I wanted to separate a few file from the framework. Let's say I have Class A,B,C,D,E,F,G. I wanted to move Class D and E out of the framework and keep it separate. Creating a new static/dynamic framework/SPM/Target is giving compilation error as Class D and E dependent on other classes. Is there a way to separate Class D and E by putting them in a separate container and import them in the framework?
0
0
530
Sep ’22
Sticky keys on by itself
Sticky key settings including activating it by tapping the shift key 5 times are disabled. However, the sticky key is activated automatically, so macOS behaves like the Shift Key is being pressed. I updated to the latest OS version and logged into safe mode a few times but no help. I verified all the settings related to Sticky keys are disabled Anyone faced this experience. How to stop activating the Sticky keys.
0
0
240
Sep ’24
Objective C protocol implementation in Swift
I have a framework written in Objective-C. My framework is in Swift and imported the 3rd party Objective-C framework in my project. @interface AAAA: NSObject(void)setHandler:(idHandler)handler @end I wanted to implement the Handler protocol in my Swift project. I did like this Class ZXY: NSObject, Handler{ init(){ super.init AAAA.setHandler(self) } // Implemented Handler Protocol optional methods func aaaa(){ } } Handler protocol optional method aaaa never called. Am I missing anything
1
0
1.1k
May ’21