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

NSSplitviewController programmatically

I have a NSSplitViewController with 2 view controllers as splitViewItems. This works fine. Now I would like to set an own SplitViewController Class for my Splitviewcontroller in the storyboard. I give it my own class start the app. But now I only…
Trombone0904
  • 4,132
  • 8
  • 51
  • 104
5
votes
0 answers

What's the cause of crash "Crashed: com.apple.main-thread EXC_BREAKPOINT"

I'm getting this crash on crashlytics (fabric), but unable to reproduce it or understand its origin based on the traceback. Crashed: com.apple.main-thread 0 MyApp 0x1001080a0 MyViewController.viewWillAppear(Bool) -> ()…
Forge
  • 6,538
  • 6
  • 44
  • 64
5
votes
2 answers

Text Shadow - iOS, swift 3.0

I'm trying to make shadow size a bit bigger but I can't do it. so far: findAPlace.titleLabel?.layer.shadowOffset = CGSize(width: -1, height: 1) findAPlace.titleLabel?.layer.shouldRasterize = true findAPlace.titleLabel?.layer.shadowRadius =…
Dpetrov
  • 546
  • 2
  • 5
  • 12
5
votes
2 answers

How to keep a 30˚ distance between two lines anchored at a point

I am trying to create two lines that are anchored at a certain point (sprite) and rotate to form a 30 degree angle between them. Below is an image what I want to achieve. This is what I've done so far: extension Int { var degreesToRadians: Double…
iGetIt
  • 695
  • 5
  • 20
5
votes
1 answer

Different classes work together

I work with swift 3 for macOS and I have a general question. In my Storyboard are two View Controllers with a tableview for each View Controller. Example: View Controller A > VC_A.class View Controller B > VC_B.class Both View Controllers are…
Trombone0904
  • 4,132
  • 8
  • 51
  • 104
5
votes
2 answers

What is the shortest code to get surrounding coordinates?

I don't like my following implementation of surroundingPositions to get the x- and y-Coordinates surrounding a specific position, because in my opinion it is too long for the simple intent and it has a pyramid of doom structure. struct Position:…
Benno Kress
  • 2,637
  • 27
  • 39
5
votes
1 answer

Sum all values of a textfield of a NSTableView column

I work with swift 3 and I have a NSTableView (3 columns). I fill the data like below: func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? { var cellIdentifier = String() var cellText =…
Trombone0904
  • 4,132
  • 8
  • 51
  • 104
5
votes
3 answers

How can I subscribe user to a topic for notifications as soon as app starts up?

I am using HTTP POST to send notifications to all users on the app. To do this I have a topic to subscribe to called "global". I want every user to be automatically subscribed to this topic to make sure they get the notifications (assuming they have…
5
votes
0 answers

willpresentnotification method not called

At first glance, this may look similar to many other questions on stack overflow, but I didn't find the solution for the issue I am facing. I am using xcode 8.3.2 and ios 10.3.2 and configured FCM to send push notifications. I am receiving push…
5
votes
1 answer

Animated curve line in Swift 3

I want to draw some bezier lines and I want to animate them with a wave effect, Example Do you have some ideas about how I can do this ? Bezier line is it the best method to do it ? I found only 2 libs for this, but they are not really useful for…
Badr Filali
  • 279
  • 5
  • 21
5
votes
4 answers

The NSFormatter for Converting English Number to persian or arabic Number in Swift 3

I read the similar questions here and Write this method in my app let formatter = NumberFormatter() func convertEngNumToPersianNum(num: String)->String{ let number = NSNumber(value: Int(num)!) let format =…
Saeed Rahmatolahi
  • 1,317
  • 2
  • 27
  • 60
5
votes
1 answer

Swift Photo Library Access

I would like to access photos from the user's photo library in my app and I was looking at the UIImagePickerController to do so. However, I was wondering if it is possible to access and view the photos from the photo library without actually storing…
ThatOneGuy
  • 160
  • 4
  • 12
5
votes
2 answers

How to dismiss a popover in a UI Test

I have a view controller that is presented using a "Present As Popover" segue. When I run the app it works as expected and tapping outside of the popover will dismiss it. However, when I run my UI test, I can't get the popover to dismiss. How should…
beyerss
  • 1,302
  • 3
  • 21
  • 38
5
votes
1 answer

Swift: Self.init called multiple times in initializer

This one has me stumped. I can't figure out why Swift is complaining that self.init is called more than once in this code: public init(body: String) { let parser = Gravl.Parser() if let node = parser.parse(body) { …
devios1
  • 36,899
  • 45
  • 162
  • 260
5
votes
3 answers

url(forUbiquityContainerIdentifier) returns nil

I'm trying to get the url for my contrainer ID but the method keeps returning nil. I've done the following: Enabled iCloud Key-value storage in Xcode capabilities. testing on a physical device. iCloud, and iCloud Drive turned on in the…
Ennabah
  • 2,303
  • 2
  • 20
  • 39