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

Why does a public class/struct in Swift require an explicit public initializer?

Consider the follow class (equally applicable to a struct, as well) in a module: public class Foo { public func bar() { // method body } } Note, it does not have an explicit initializer; this example doesn't need any special…
Wayne Hartman
  • 18,369
  • 7
  • 84
  • 116
36
votes
2 answers

Swift 3 error: "See also" callout not showing

I just migrated my project to Swift 3 and found that the "See also" callout in the quick help is not showing. Everything was perfectly working in the previous version of Swift. Below is my code: /** Adds a "See also" callout in the Quick Help for a…
Tapas Pal
  • 7,073
  • 8
  • 39
  • 86
36
votes
6 answers

case insensitive matching search in string array swift 3

In Swift 3, I want to create an array of matching string (case insensitive) from string array:- I am using this code, but it is case sensitive, let filteredArray = self.arrCountry.filter { $0.contains("india") } how can I do this.. suppose I have…
Mayank Jain
  • 5,663
  • 7
  • 32
  • 65
36
votes
9 answers

Error when build project in new Xcode 8.0 beta

Signing for SWRevealViewController requires a development team. Select a development team in the Target Editor. Code signing is required for product type 'Framework' in SDK 'iOS 10.0'
Alex_Burla
  • 800
  • 1
  • 9
  • 9
35
votes
3 answers

How to sync records between Core Data and CloudKit efficiently

I'm currently learning how to use CloudKit Framework and lack of documentation or examples showing how to sync Core Data and CloudKit. I have watched all WWDC videos (2014, 2015, 2016) Dedicated to CloudKit, but none of them telling us how to…
Adelmaer
  • 2,209
  • 3
  • 22
  • 45
35
votes
8 answers

How to make UISlider default thumb to be smaller like the ones in the iOS control center

I'm working on an app and I have a custom UISlider. However, I'm having some issues on how to make the default thumb to appear smaller like the ones in the iOS control center. Note that I want the same iOS thumb, not a custom thumb image. So far,…
UI Scuti
  • 375
  • 1
  • 3
  • 5
35
votes
6 answers

Create Directory in Swift 3.0

I am a new student in 9th grade learning swift, creating a school project . I am trying to create a directory where I want to save a scanned file into pdf format. While creating directory I am getting error below. Error 1: Cannot use instance…
Neeld
  • 503
  • 1
  • 4
  • 10
35
votes
1 answer

Can't pass Date to NSPredicate(format: ...) without "as CVarArg"

Is this how I'm supposed to pass a Date to NSPredicate.init(format predicateFormat: String, arguments argList: CVaListPointer). let endDate = Date() NSPredicate(format: "endDate == %@", endDate as CVarArg) It looks kinda clumsy, and I suspect I'm…
netdigger
  • 3,659
  • 3
  • 26
  • 49
35
votes
2 answers

FIRInstanceID/WARNING STOP!! Will reset deviceID from memory [Xcode : Console Log]

After updating to XCode 8 GM(Swift 3) Firebase started logging these error's in the Console:- FIRInstanceID/WARNING STOP!! Will reset deviceID from memory. FIRInstanceID/WARNING Failed to fetch default token Error Domain=com.firebase.iid Code=6…
Dravidian
  • 9,945
  • 3
  • 34
  • 74
34
votes
5 answers

Cancel a request Alamofire

I am sending a request which is triggered based on timer. But if I press the back button the request still seems to be active and the response in turns crashes the app. Kindly suggest a way to cancel the request. Using Xcode 8.2.1 Swift 3 Here is…
Ankit Kumar Gupta
  • 3,994
  • 4
  • 31
  • 54
34
votes
4 answers

Swift 3 warning for dispatch async

I have this code: DispatchQueue.global(priority: DispatchQueue.GlobalQueuePriority.default).async { let url = URL(string: itemImageURL ) let data = try? Data(contentsOf: url!) if data != nil { …
asheyla
  • 3,175
  • 5
  • 18
  • 34
33
votes
9 answers

Swift display time ago from Date (NSDate)

In a cell I want to display the time ago from the NSDate in the Parse server. Here is the code but its not working. Nothing is changing, and the data isn't being parsed. if let createdat = (object?["createdAt"] as? String){ let…
john
  • 507
  • 1
  • 5
  • 15
33
votes
2 answers

How to update an object in Realm Swift

I'm trying to learn how to use Realm Swift and Charts so I can eventually use them both in an app I'm building and I'm having a hell of a time figuring out Realm. Eventually, I'm planning on having Charts look at my Realm DB and then display the…
jammyman34
  • 1,399
  • 4
  • 15
  • 22
33
votes
5 answers

No such module "PackageDescription"

I just started with swift 3 and made a simple app in xcode using Swift 3.0 . Now i want to add a third party library using Swift Package Manager . I am following installation method given in this link . I created Package.swift file which looks like…
Ahsan Attari
  • 987
  • 3
  • 12
  • 26
33
votes
2 answers

How do you write a completion handler in Swift 3?

I was wondering how to make a completion handler for a function I'm creating in Swift 3. This is how I did my function right before I updated to Swift 3: func Logout(completionHandler: (success: Bool) -> ()) { backendless.userService.logout( …
Noah G.
  • 375
  • 1
  • 3
  • 14