Tag: swift3

<unknown>:0: error: type 'Key' constrained to non-protocol type 'String'

Migrating to Swift 3 from 2.3 and am running into this issue. The error is traceable to a view controller. I do not see any extensions/protocols which would require a ‘Key’ constrained to ‘String’. I’ve tried to comment out code that might be causing the error, and have had strange results – ie removing an […]

How to parse JSON code to Swift 3 Table View data?

I am creating an ios application using swift 3 and MySQL and PHP as database. I wanted to output the data from database to a tableview but i kept having an error: Error Domain=NSCocoaErrorDomain Code=3840 “JSON text did not start with array or object and option to allow fragments not set.” I tried to check […]

How to change button title from table static cells?

I have HomeViewController that’s segued modally to a Navigation Controller with an identifier of: pickSubjectAction And on SubjectPickerTableViewController is where my subjects to choose. This is my code import UIKit class SubjectPickerTableViewController: UITableViewController { var subjects:[String] = [ “English”, “Math”, “Science”, “Geology”, “Physics”, “History”] var selectedSubject:String? { didSet { if let subject = selectedSubject { […]

CollectionView in TableViewCell scroll isn't smooth in swift3

In my project CollectionView in TableViewCell isn’t display and I added cell.collectionView.reloadData() in my code. After I added, CollectionView displayed in TableViewCell, but ScrollView isn’t smooth. How to solve this problem. If someone have any experience or ideas help me. Thanks. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: […]

Passing data from Marker to other VC

At the beggining of this post I would like thank @Nirav D for help 🙂 Ok. So the problem. There is a class i want to pass with prepareForSegue func with google marker. How to do it?

Error Domain=NSOSStatusErrorDomain Code=-12780 \“(null)\”

When I try to export the asset with AVAssetExport I get the following error only on videos received through whatsapp probably. I could not find a working solution. I’ve also tried implementing code to fix video duration, but I did not fix it. Error is : Error Domain=NSOSStatusErrorDomain Code=-12780 \”(null)\” Here code PHCachingImageManager().requestAVAsset(forVideo: asset.phAsset!, options: […]

Making table view section expand swift

I am following this tutorial for expanding and collapsing my table view section. As this demo is done in swift 2.2 I have made all the changes according to swift 3.0 . I am stuck at the below function at if condition(currentSectionCells[row][“isVisible”]) which gives me error as “Type ‘NSFastEnumerationIterator.Element’ (aka ‘Any’ has no subscript members)’”. […]

Where are the swift/swiftc binaries for v3?

I’ve just downloaded the Xcode 8 beta, and am struggling to figure out where the swift and swiftc binaries are hidden. The Swift website says that the toolchain should be available at /Library/Developer/Toolchains and that it can be exported for use on command line with: $ export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:”${PATH}” But that path doesn’t seem to exist […]

Get GCD label in Swift 3

I’ve got some code that gets the label of the current GCD queue for logging purposes that looks like this in Swift 2: if let queueName = String(UTF8String: dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL)) where !queueName.isEmpty { detailedMessage += “[” + queueName + “] ” } After Xcode 8 converted this to Swift 3, it looks like this: if let […]

Microsoft Azure remote notifications in Swift 3

I am working on an iOS app in Xcode 8.2.1 using Swift 3.0. I’d like for this app to be able to receive remote push notifications using Microsoft Azure. However, I’m having trouble implementing this. Most guides I’ve found are for older versions of Swift and don’t work anymore. The only one I was able […]