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
3 answers

Space in query string of a URL Making it nil

I am working on a Swift 3.0 app, in which I am making a rest api call. The problem is that there may be a space in query string parameter, which is causing the URL to become nil. It works fine when there is no space in that parameter. But with a…
Sundeep Saluja
  • 1,089
  • 2
  • 14
  • 36
5
votes
2 answers

Progress alert not dismissing from view in Swift 3

I'm trying to create a function for showing and dismissing a ProgressDialog in Swift 3. But in this code the dialog is not dismissing from the view controller. func showLoadingDialog(show : Bool) { if show { self.alert =…
Vinayak B
  • 4,430
  • 4
  • 28
  • 58
5
votes
3 answers

NSCache Doesn't work with all images when loading for the first time

I'm woking on a project in swift 3.0 where I cache the response from the server by using NSCache as to populate them in a UITableView. However for some reason I'm only seeing few images loading when the app loads for the first time, but if If i…
danu
  • 1,079
  • 5
  • 16
  • 48
5
votes
1 answer

When added to a view, the constraint's items must be descendants of that view (or the view itself).

Here is my following code: func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { let headerView = UIView() headerView.backgroundColor = UIColor.white let headerLabel = UILabel(frame: CGRect(x: 30,…
Chelsea Shawra
  • 1,593
  • 4
  • 22
  • 43
5
votes
2 answers

NSTextStorageDelegate's textStorage(_,willProcessEditing:,range:,changeInLength:) moves selection

I'm trying to implement a syntax-coloring text editor that also does things like insert whitespace at the start of a new line for you, or replace text with text attachments. After perusing the docs again after a previous implementation had issues…
uliwitness
  • 8,532
  • 36
  • 58
5
votes
1 answer

UILabel and UITextView not correctly aligned

I do have a UILabel and UITextView above each other, left aligned with Auto Layout. But it looks like this: What's the best way to correctly align these?
swalkner
  • 16,679
  • 31
  • 123
  • 210
5
votes
1 answer

[NSNull pointSize]: unrecognized selector sent to instance in swift3 while using custom fonts

I am trying to customize the font of the UISegmented control and i am using the following code as shown below: let selectedfont = UIFont(name:"Roboto-Bold", size:22) let unselectedfont = UIFont(name:"Roboto-Regular", size:22) let…
Chelsea Shawra
  • 1,593
  • 4
  • 22
  • 43
5
votes
2 answers

Unable to update local scheduled notification content

In one of the WWDC sessions I got code snippet for updating existing notifications. I don't think it works. Trying to update notification content. First I request pending notifications from UNUserNotificationCenter which always works. Then I am…
Boris Y.
  • 4,387
  • 2
  • 32
  • 50
5
votes
5 answers

how to set cornerRadius for only top-left corner of a UILabel?

import UIKit class ViewController: UIViewController { @IBOutlet weak var myText: UILabel! override func viewDidLoad() { super.viewDidLoad() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() } }
amin sadeghian
  • 131
  • 1
  • 10
5
votes
2 answers

Swift: Nested type erasure

Using Swift 3.0 (I could use Swift 4.0 if that would help me... But I don't think it will) I would like to Type Erase two levels. I what to type erase a protocol having an associatedtype, which conforms to a protocol that in turn itself has an…
Sajjon
  • 8,938
  • 5
  • 60
  • 94
5
votes
2 answers

UIImagePickerController leaking memory after launch and during taking a picture. Makes app crash after taking more than a 100 pictures

I have been struggling with this issue for weeks now. I have look online all over the place and found nothing close to this issue other than this 2 outsider…
Fidel
  • 1,173
  • 11
  • 21
5
votes
1 answer

Get local notification's body text or identifier in AppDelegate Swift

I want to access my application data in AppDelegate.swift whenever the app receives an action response. I was trying to use the func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse,…
Eric Hua
  • 976
  • 2
  • 11
  • 29
5
votes
2 answers

How to compare 'CBCharacteristic.uuid == "String"' in swift?

How to compare this? uuid and string cant compare func charValues() { let charValue = String(data: getCharacteristic.value!, encoding: String.Encoding.ascii)! if getCharacteristic.uuid == "Manufacturer Name String" { …
Deepak Tagadiya
  • 2,187
  • 15
  • 28
5
votes
1 answer

Getting error Unsupported Grant type?

I am not able to login in my Application which uses Oath-2 and getting error of unsupported_grant_type.I am using Alamofire to POST login data but not able to succeed.Where i am doing Wrong ?I am not able to solve the issue. func sendFeedback() func…
Bikesh Thakur
  • 846
  • 7
  • 22
5
votes
3 answers

Swift 3 - Atomic boolean

Does anybody know how to make an atomic boolean in iOS 10? Current code: import UIKit struct AtomicBoolean { fileprivate var val: UInt8 = 0 /// Sets the value, and returns the previous value. /// The test/set is an atomic operation. …
PAK
  • 431
  • 4
  • 17