Posts

xcode error multiple commands produce core data

Image
 Solution: If you started with coredata and created models after that if run the app it shows an error like below. "xcode error multiple commands produce core data of your coredataClass"  Then you need to configure the coredata as like below image. Select your entity and click the last option in the right side menu as like above and click module default it selected class definition.You have to change it to manual/none. After that delete your coredata classes you created and create it again.It will solve your problem.

Alertbox function for common utils iOS swift || Alertbox custom function in common

 Solution: You can use the below function to show alert as a single function you can call wherever you want. Also must to be implement the extension of the application.      func showAlert(msg: NSString ,controller: UIViewController ) {         if let topController = UIApplication . topViewController () {             if ! (topController is UIAlertController ) {                 let alert = UIAlertController (title: "Apptitle"   as String , message: msg as String , preferredStyle: . alert )                 alert. addAction ( UIAlertAction (title: "OK" , style: . default , handler: nil ))                 topController. present (alert, animated: true , completion: nil )             }         }     } Use the extension of the applica...

iPhone simulator coredata data not clear while uninstall the app in Xcode

 Solution: It had two solutions. 1. You can go simulator menu Device -> erase all content and settings works well. 2. Also if you created group for your app and run it after that you can uninstall the app it will clear all data.

button title after image swift iOS || Align button title before button image iOS swift

 Solution: You can align the text in front of the button then you can set the image is possible like below:       cell. button . semanticC ontentAttribute  =  UIApplication . shared           . userInterfaceLayoutDirection  == . rightToLeft  ? . forceLeftToRight  : . forceRightToLeft

Take screenshot in iOS simulator

 Solution: You can easily take screenshots in the simulator.Just open the simulator and click command+S it will take screenshot in your simulator. Captured screenshot will be saved in the desktop on our Mac.

Get the bound box for a cgPath with +10 of width and height in swift iOS

 Solution:      let  selectionBox = appenedPath. boundingBox . insetB y (dx:  -10.0 , dy:  -10.0 )

Compare array contains same object iOS swift

 Solution: We had an option that will compare single array with its object's all are equal or different. In that we can use "Set" function like below. Code: let myArrayA = [1,2,3] let myArrayB = [1,1,1] If(Set(myArrayA).count == myArrayA.count) { print("different") } else { print("same") }  If(Set(myArrayB).count == myArrayB.count) { print("different") } else { print("same") }  The first one returns different and the second one returns same...Happy coding....