Questions tagged [swift3]

Use this tag only for questions directly related to changes in version 3 of Apple's Swift programming language. Use the tag [swift] for more general language questions, or the tags [ios], [cocoa], [apple-watch] etc for questions about developing on Apple platforms.

Swift 3 is the version of Apple's programming language Swift. It was released on September 13, 2016. The language is open source and available on Github (see ).

The development of Swift 3 and its goals can be viewed on the Swift Programming Language Evolution repository on Github.

For more information, please visit Swift's Getting Started page.

18453 questions
5
votes
2 answers

Cannot use instance member 'getA' within property initializer; property initializers run before 'self' is available

Y this giving this error - Cannot use instance member 'getA' within property initializer; property initializers run before 'self' is available class A { var asd : String = getA() func getA() -> String { return "A" } }
vaibby
  • 1,255
  • 1
  • 9
  • 23
5
votes
1 answer

Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" {Error Domain=NSOSStatusErrorDomain Code=-16976 "(null)"}

I am working on Video application in Swift3 iOS. Basically I have to merged the Video Assets and Audios into one with Fade Effect and save this to iPhone gallery. To achieve this, I am using below method: private func doMerge(arrayVideos:[AVAsset],…
user2786
  • 656
  • 4
  • 13
  • 35
5
votes
1 answer

HKSampleQuery returns no results even when there are

I'm trying to get all heart rate samples from the past month, and extract the times and values from them. So far, I've got the following method: func getThisMonthsHeartRates() { print("func called") let heartRateUnit:HKUnit = HKUnit(from:…
bdv
  • 1,154
  • 2
  • 19
  • 42
5
votes
1 answer

Saving data in child context with privateQueueConcurrencyType

Once I download data from server, I am trying to save data in Core Data. As per Apple documentation I am using parent-child context to perform save operation, as follow: fileprivate func saveDataInLocalDataBase(_ mList: [Info]?) { if mList !=…
Nuzhat Zari
  • 3,398
  • 2
  • 24
  • 36
5
votes
2 answers

iOS Swift, AWS Cognito User Pool, Unable to Refresh Access Token

Looked at similar SO questions which didn't help me resolve the issue. I am using AWS Cognito User Pools in our iOS App. We are able to successfully create and login the user. However after about an Hr the access token is not available, I understand…
SpaceX
  • 2,814
  • 2
  • 42
  • 68
5
votes
0 answers

How to set Audio streaming URL as AVAudioFile?

I am following this tutorial :https://miguelsaldana.me/2017/03/13/how-to-create-a-soundcloud-like-waveform-in-swift-3/ My code given below .There is an exception : Error Domain=com.apple.coreaudio.avfaudio Code=2003334207 “(null)” …
Nahid Raihan
  • 957
  • 1
  • 10
  • 20
5
votes
6 answers

Swift Change label text color on tap from within TableViewCell

I have a UILabel that is inside a TableView, I want to change the color of the UILabel to red on user tap. I am using a UITapGestureRecognizer and on tapping the UILabel I can get the content of the UILabel but I can't get the actual UILabel since…
user1591668
  • 2,591
  • 5
  • 41
  • 84
5
votes
1 answer

How to save a default printer in UserDefaults in Swift?

This is the workflow of my app: User can select a default printer from app's settings page and will use this default printer to print every time directly without any print preview dialogue. We can select a printer using…
anas.p
  • 2,246
  • 19
  • 26
5
votes
2 answers

how to correctly add sqlite frameworks to the Xcode project?

I am trying to add SQLite to my project.I checked the target dependencies under the build phase tab,it is empty, which is true.I am getting the following error:Unable to run command 'Ld SQLite' - this target might include its own product." I am…
matlabuser
  • 101
  • 1
  • 11
5
votes
1 answer

UNUserNotificationCenter.current().getDeliveredNotifications only returns empty array

I am trying to retrieve all delivered notifications still showing in the notification center but UNUserNotificationCenter getDeliveredNotifications(completionHandler:) just doesn't work. I can get all the pending notifications with…
5
votes
2 answers

Buttons not visible in UIDocumentPickerViewController

I want to import a document into my application. I have created a Demo to import Document. A demo is working. below is the code of the Demo to open UIDocumentPickerViewController. -(IBAction) btnOpenClicked{ UIDocumentPickerViewController…
Crazy Developer
  • 3,464
  • 3
  • 28
  • 62
5
votes
1 answer

On-demand resources - Force purge/clear of downloaded resource bundles

I have an swift4 app that is having certain issues where on-demand resources packages hang when downloading. The issue appears to be related to different versions of resource bundles being used in testflight environment as opposed to prod. Some…
Villainsoft
  • 137
  • 7
5
votes
2 answers

Image size is resized when convert it from data in swift 3

I want to save an image in database. Therefore I convert it to Data. However during these steps the width and height of the image will change. It is increased in size. // Original Image Size print("Original Image Size : \(capturedImage.size)") //…
Muthu Sabarinathan
  • 1,198
  • 2
  • 21
  • 49
5
votes
1 answer

How to programmatically open the Bluetooth settings in iOS 11

Code that I used for iOS 10 no longer works on iOS 11... Any ideas what to change? I need to open Bluetooth Settings not general iOS Settings that is getting opened by code below if let settings = URL(string: "App-Prefs:root=Bluetooth") { …
Yaroslav Dukal
  • 3,894
  • 29
  • 36
5
votes
1 answer

How to document parameters of a closure that's a parameter

My attempt at documenting a closure parameter to a function: /** sends the request out. - Parameter pzurl: request description including url, method, formdata. - Parameter responseProcessor: closure that's on success invokes - Parameter…
Anton Tropashko
  • 5,486
  • 5
  • 41
  • 66