swift - How to show activity indicator while passing between view controller -
lets have 2 viewcontrollers
, in mainviewcontroller have button performs segue secondviewcontroller. when button tapped, i'm saving initial data coredata, takes time.
here thing want do; while passing between viewcontrollers, want show activityindicator
, starts after secondviewcontroller opened. me? i'm new swift.
here code used in mainvc:
override func prepare(for segue: uistoryboardsegue, sender: any?) { if (segue.identifier == "secondviewcontroller") { swiftspinner.show("loading") // act. indicator found on github willrunonce() // here im saving data coredata swiftspinner.hide() } }
instead of adding code of activityindicator
in prepare(for:sender:)
method need call in button action , after call performsegue(withidentifier:sender:)
method.
@ibaction func onbtnskip(_ sender: uibutton) { swiftspinner.show("loading") // act. indicator found on github willrunonce() // here im saving data coredata swiftspinner.hide() //now performsegue self.performsegue(withidentifier: "identifier", sender: nil) }
Comments
Post a Comment