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
1 answer

Passing data with InstantiateViewController

I have this code however, I'm not receiving the data in the second view controller... What am I doing wrong here? let storyboard = UIStoryboard(name: "PostSubmit", bundle: nil) let vc =…
Denis
  • 570
  • 9
  • 23
5
votes
1 answer

Swift get headers from UIWebView response

I am unable to get headers from a UIWebView response as the response apparently hasn't been cached. Is there a workaround? I have tried code from here. My application uses mixed native iOS view controllers and UIWebView. When I start a UIWebView…
markhorrocks
  • 1,199
  • 19
  • 82
  • 151
5
votes
5 answers

How to compare UIViewController in Swift 3?

I am trying to compare to UIViewController in Swift 3 but there is some error extension UINavigationController { func myPopToViewController(viewController:UIViewController, animated:Bool) -> UIViewController? { var…
Varun Naharia
  • 5,318
  • 10
  • 50
  • 84
5
votes
2 answers

Swift 3: How to get language code from a country code?

I want to get the main language of a country. For example: "US" -> "en" or "VN" -> "vi" In Swift 3, are there any ways to do this?
Danh Huynh
  • 2,337
  • 1
  • 15
  • 18
5
votes
1 answer

Navigation Controller Black when trying to make transparent

Completely stumped. I've looked all over and implemented every solution I could find. I can't seem to get the navigation bar to become transparent. When trying to set the background color, I just get a black bar at the top. Same as if I try to set…
5
votes
2 answers

What should I be returning in a getter method in swift

var userState: UserState { get { return userState } set { print("\(self.userState)") } } Returning userState causes an infinite loop. I'm not interested in the getter method and just want to return the value of the…
user1898829
  • 3,437
  • 6
  • 34
  • 62
5
votes
3 answers

Why does Swift 3 need @escaping annotation at all?

I read this question and answers and Cocoacasts blog post and I fully understand what is @escaping annotation. But honestly I do not understand why we need it at all. The above Cocoacasts blog post states that: There are several benefits to make…
mixel
  • 25,177
  • 13
  • 126
  • 165
5
votes
2 answers

Alamofire Type 'ParameterEncoding' has no member 'URL' Swift 3

I am trying to migrate my codes from swift 2 version to swift 3 version. I could not migrate following code part and I did not find any solution for it. How can I do it? // MARK: URLRequestConvertible public var URLRequest: NSMutableURLRequest…
Jessica
  • 165
  • 3
  • 12
5
votes
0 answers

Swift generate random number without arc4random

I want to generate a random number in Swift within a function deployed to OpenWhisk on IBM Bluemix. Because it's a Linux runtime, I can't use arc4random_uniform(). I also don't want to use drand48() because it doesn't give me a truly random number…
dokun1
  • 2,120
  • 19
  • 37
5
votes
3 answers

Swift 3 - Saving images to Core Data

For some reason I can't figure out how to save images to core data and fetch them again. I have a feeling it's something about my types but have a look: I get my data from an api call to my server. It returns a base64 string. Here is where I get…
Steffen L.
  • 149
  • 2
  • 14
5
votes
1 answer

How to prevent a UILabel from blocking a touch to a parent UIButton in Swift?

I have a UIButton that has four child UILabels that contain information about the button's functionality. When I click the center of the button the action does not fire because it is being blocked by the UILabels but when I click the outside of the…
KevinZ
  • 756
  • 1
  • 12
  • 26
5
votes
2 answers

Implementing google translation api in swift 3 iOS

Hi i am new to iOS development and i am trying to implement google translation API within my app. I found some sample code online from GitHub https://github.com/prine/ROGoogleTranslate. I downloaded the sample code and followed the instructions…
aneey123
  • 51
  • 1
  • 3
5
votes
2 answers

Save photo with geolocation data to photo library Swift 3

How can I save a photo to photo library with geolocation metadata? I have requested (and allowed) the app to access user location: private func allowAccessToUserLocation() { locationManager = CLLocationManager() …
George Asda
  • 2,119
  • 2
  • 28
  • 54
5
votes
2 answers

Swift - generate one time UUID

In swift, this code generate a random uuid... let uuid = UUID().uuidString I have it so when I click on a button, it gets the uuid and prints it to the console, however, when I click the button once more, I get a different uuid. I want to be…
adam eliezerov
  • 2,185
  • 2
  • 11
  • 17
5
votes
0 answers

How to create border in ciimage in swift

I'm writing a feature for correcting perspective of documents scanned from ios camera. I want to create a border effect around the document whose edge has been determined. CiImage has the initializer property with which i can create a color overlay…
Nutan Niraula
  • 156
  • 1
  • 7
1 2 3
99
100