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.

18403 questions
5
votes
6 answers

Swift 3 - How to write functions with no initialisers like the new UIColors?

In previous versions of swift, you would get the colour white like this UIColor.whiteColor() However, in Swift 3, you get the colour white without initialisers like so UIColor.white How would I write this same function without having to use…
Josh
  • 735
  • 1
  • 7
  • 22
5
votes
0 answers

Creating Swift Struct and Classes from String

I want to do something along those lines: class MyClass {} struct MyStruct {} let newStruct = typeFromName("MyStruct").init() let newClass = typeFromName("MyClass").init() I would like to be able to load information from a config file that would…
Vincent Bernier
  • 8,534
  • 4
  • 32
  • 39
5
votes
1 answer

Does the initializer of an `open` class need to be open as well?

Swift 3 introduced the new open keyword that I'm using in a framework. Does an open class in this framework require an open initialiser to be used outside of said framework, or does the init function inherit the open declaration on the class? For…
perhapsmaybeharry
  • 824
  • 15
  • 32
5
votes
1 answer

String(data: x, encoding: NSUTF8StringEncoding) equivalent in Swift 3?

In earlier versions of Swift I could convert NSData to a UTF8 string thus: let desc:String = String(data: requestData, encoding: NSUTF8StringEncoding) (The documentation for NSString's init(data:NSData,encoding:NSStringEncoding) is here.) In Swift…
dumbledad
  • 12,928
  • 20
  • 97
  • 226
5
votes
1 answer

UIView Shadow using User Defined Runtime Attributes

I'm having a hard time getting a drop shadow to show when I am using "User Defined Runtime Attributes". It seems to work completely fine if I use code, as follows. func formatView(view: UIView, cornerRadius: Bool) { if (cornerRadius)…
Jason Brady
  • 1,034
  • 1
  • 11
  • 27
5
votes
1 answer

How to update pods to Swift 3.0

Currently in the process of migrating to Swift 3.0. This is my first time doing anything like this and I am not entirely sure how to deal with the various pods I am using. For example I am using the pod SwiftDate:…
Kex
  • 6,762
  • 5
  • 39
  • 93
5
votes
2 answers

iOS10: Auto play not working on WKWebView (requiresUserActionForMediaPlayback = false)

Hi I am working on iOS 10 with Swift3 right now. My scenario is to autoplay a youtube video inline using WKWebView. I set the config's mediaPlaybackRequiresUserAction to false in order to enable the video autoplay, as suggested by Apple Dev…
RainCast
  • 3,048
  • 4
  • 26
  • 38
5
votes
1 answer

MailComposer didFinishWith results doesn't work in Swift 3.0

I converted my app to swift 3.0 and have a problem with MailComposeController. When I call function: `func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?){ …
PiterPan
  • 1,480
  • 1
  • 15
  • 39
5
votes
1 answer

How to send MSMessage in Messages Extension?

I want to implement an imessage app, however being new to the messages framework and iMessage apps being such a new thing there aren't many resources. So I am following the WWDC video and using Apples providing sample app for a guide. I have three…
JUSDEV
  • 711
  • 1
  • 6
  • 21
5
votes
3 answers

Xcode 8 attribute "hidden" does not hide view in Interface Builder

seems like Apple change how Interface Builder behaves in Xcode 8? Because when I check hidden in Attributes Inspector on a view in Interface Builder, that view is still visible. This makes it very tedious to work with views where some views needs to…
Sajjon
  • 5,608
  • 2
  • 41
  • 77
5
votes
3 answers

AVAudioEngine downsample issue

I'm having an issue with downsampling audio taken from the microphone. I'm using AVAudioEngine to take samples from the microphone with the following code: assert(self.engine.inputNode != nil) let input = self.engine.inputNode! let audioFormat =…
nullforlife
  • 1,244
  • 1
  • 14
  • 29
5
votes
1 answer

swift 3 and CGContextEOClip

As I am converting my code to swift 3, I got this error: error: 'CGContextEOClip' is unavailable: Use clip(using:) CGContextEOClip(context!); …
reza23
  • 2,663
  • 2
  • 24
  • 38
5
votes
5 answers

tabBar & navigation bar became dark after updating to Xcode 8

After updating my Xcode to Xcode 8, i'm facing this strange issue. I have a tab bar and 3 tabs in it when tab1 is selected tab bar and navigation looks like this : tab bar's background color is white but its showing a dark color instead and when I…
remy boys
  • 2,675
  • 5
  • 28
  • 57
5
votes
1 answer

'init' is unavailable:use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type

here is an error: 'init' is unavailable:use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type. here is my code: var inputSignal:[Float] = Array(repeating: 0.0, count: 512) let xAsComplex =…
J.doouuu
  • 65
  • 5
5
votes
1 answer

CGRectDivide is deprecated in swift 3

As swift 3 says CGRectDivide is deprecated and the replacement is divided(atDistance: CGFloat, from fromEdge: CGRectEdge) -> (slice: CGRect, remainder: CGRect). As I know CGRectDivide was dividing a source rectangle into two component rectangles by…
Termin
  • 151
  • 4
  • 13
1 2 3
99
100