How to play a sound using Swift?

Most preferably you might want to use AVFoundation. It provides all the essentials for working with audiovisual media. Update: Compatible with Swift 2, Swift 3 and Swift 4 as suggested by some of you in the comments. Swift 2.3 Swift 3 Swift 4 (iOS 13 compatible) Make sure to change the name of your tune as well as the extension. The file needs to …

Read more

Prepare for Segue in Swift

This seems to be due to a problem in the UITableViewController subclass template. It comes with a version of the prepareForSegue method that would require you to unwrap the segue. Replace your current prepareForSegue function with: This version implicitly unwraps the parameters, so you should be fine.

Alert”Developer tools access needs to take control of another process for debugging to continue.Type your password to allow this.”

The first time you launched XCode, it probably asked you if you wanted to enable Developer Mode on this mac. If you accepted, then it asked you for your password, and you stopped getting this kind of warning. Chances are good that you declined, and now it has to explicitly ask you for permission every …

Read more

Download Xcode simulator directly

Clicking on Download in Xcode didn’t do anything – the progress bar did not progress (does that make it a regress bar?). This is what worked for me: Open Xcode, open preferences, go to the Components section. Open the Console App, clear the console. Go back to the Xcode preferences. Start the simulator download, then …

Read more

Remove alpha channel in an image

Assuming you don’t have another image editor, then you can open it in Preview on your Mac, and use the Export option to resave it in a different format- to ensure you get rid of the alpha channel, it might be best to export to JPG (best quality), then open that and export it as …

Read more

Xcode: Could not locate device support files

Actually, there is a way. You just need to copy DeviceSupport folder for iOS 7.1 from Older Xcode to the new one. It’s located in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/7.1 If you don’t have the 7.1 files anymore, you can download a previous version of XCode on https://developer.apple.com/download/more/, extract it, and then copy these files to following path /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/ Credit