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

File access permission in Swift on OSX

I'm using: let dialog = NSOpenPanel() to get a file URL. I'm then reading in the contents of the text file with: let content = try String( contentsOf: dialog.url) This works! I'm then trying to read in another text file in the same directory with…
Andrew
  • 521
  • 7
  • 18
5
votes
2 answers

Pass a closure as an optional parameter of the function

I have a function which takes two parameters, the last parameter is a callback closure: func myAsycTask(name: String, callback: @escaping ()->Void) { myQueue.async{ self.doTask(name) callback() } } func doTask(name: String)…
Leem
  • 17,220
  • 36
  • 109
  • 159
5
votes
2 answers

Add ARSCNView programmatically

How can I add a ARSCNView programmatically? How can I set width, height and constraints?. class ViewController: UIViewController { var sceneView: ARSCNView! let configuration = ARWorldTrackingConfiguration() override func viewDidLoad()…
utiq
  • 1,342
  • 2
  • 17
  • 33
5
votes
3 answers

How to zoom a UICollectionViewCell on selection Swift 3.0?

Here i am trying highlight the UICollectionViewCell on selection as shown in the image.I tried adding the border to the selected cell and the border comes inside the cell content view. Here is my try: func collectionView(_ collectionView:…
5
votes
2 answers

SecPKCS12Import returns different results on iOS 11 than on iOS 10

This function takes as an argument Base64 encoded PKCS#12 certificate string which is then decoded and passed to SecPKCS12Import function. After update to iOS 11 the SecPKCS12Import, yields different results. The securityError returns 0 on both OS…
Marek
  • 3,555
  • 17
  • 74
  • 123
5
votes
3 answers

'ProjectName-Swift.h' file not found on Xcode 9 using Swift 4?

I am trying to add swift 4 file in objective c project on Xcode 9. For that i am following these steps - step 1: suppose swift class name is ShowAlertSwift.swift import UIKit @objc public class ShowAlertSwift: NSObject { @objc func…
Shubham JAin
  • 593
  • 8
  • 15
5
votes
2 answers

Avoid creation of multiple ViewController instances, iOS Swift

In AppDelegate, the below function gets called whenever VoIP call (push notification) is received thereby creating multiple instances of "VideoCallViewController" I've used deinit (in VideoCallViewController) as shown below, to check if the previous…
SpaceX
  • 2,814
  • 2
  • 42
  • 68
5
votes
1 answer

Xcode 8 : PAC Fetch failed with error [NSURLErrorDomain:-1003] log on Console window

I’m getting some strange log on console window while working on project. These are mentioned below : nw_parameters_set_source_application Failed to convert from PID (0) to UUID. This could lead to wrong data usage accounting. PAC Fetch failed with…
Jayprakash Dubey
  • 35,723
  • 18
  • 170
  • 177
5
votes
1 answer

swift 3.0 multiple selection with Select All option

i have added data in table view and i have manually added "select all" option in to list at first position now when user select first option which is select all then all item in to list should be selected and deselected when choose same. i have…
Jayprakash Singh
  • 1,343
  • 3
  • 15
  • 28
5
votes
3 answers

Cannot convert value of type '(key: String, value: AnyObject)' to expected argument type '[String : AnyObject]'

I'm trying to get to the url of thumbnail_images from the JSON response I got as shown in this picture below: So in order to reach to the url I made a class called Posts in which class Posts: NSObject { var title: String? var excerpt:…
Chaudhry Talha
  • 7,231
  • 11
  • 67
  • 116
5
votes
1 answer

Swift 3 Core Bluetooth not discovering services

I'm trying to discover services from a BLE device I've connected to from my iOS app, but when my didDiscoverServices function gets called, the peripheral services array is empty. The app connects to the device, runs peripheral.discoverServices(nil) …
AdamDWalker
  • 271
  • 3
  • 8
5
votes
0 answers

Xcode: suppressing specific warning

To disable compiler warning I go to Project -> Target -> Build Settings and add flag -w for specific file. This flag disables all warnings. But my intention is to exclude a specific warning, not all. I found a solution like…
David Silva
  • 1,939
  • 7
  • 28
  • 60
5
votes
3 answers

how to check condition with "" in swift 3.0

I want to check that the maxprice is equal to "" this or not if it's "" then maxprice will become maxprice = 0 my Json price = ({ maxprice = ""; minprice = ""; }); code var Arr = NSArray() Arr = result.value(forKey: "price")…
user8198079
  • 53
  • 1
  • 1
  • 5
5
votes
2 answers

NVActivityIndicatorView only for particular view

I am using this library https://github.com/ninjaprox/NVActivityIndicatorView for showing the loading indicator. By default it blocks the entire view controller but how can I show the activity indicator only for the particular view. For example if a…
Prabu Raj
  • 577
  • 1
  • 6
  • 11
5
votes
1 answer

How to add a attachment in outlook programatically swift 3

I have opened the outlook app and send a file in it. I am able to open the outlook and set the To,Subject and Body but not sure how to attach file in the document directory The file is at path var paths =…
Warrior
  • 39,156
  • 44
  • 139
  • 214