Only use this tag if your question is about a specific change introduced in `Swift 3.1`. For generic Swift questions, use the [swift] tag.
Questions tagged [swift3.1]
29 questions
9
votes
1 answer
Swift 3.1 Nested Generics Bug with Cyclic Metadata
First of all, thank you for visiting. I'm currently playing with Swift 3.1 Nested Generics and I've encountered an error with initialization.
class NestedProduct {
enum Gadget {
case smartphone
case laptop
case fridge
case…
![](../../users/profiles/6298163.webp)
Bob Lee
- 667
- 4
- 10
8
votes
1 answer
Creating Complications for Apple watch
I know how to create the basic watch complications.
I want to create complication like native Battery one (Circular Ring).
How can I fetch live data for the complications, maybe API call, or data from iPhone?
Can I create more then one same…
![](../../users/profiles/4715546.webp)
Parth Adroja
- 11,417
- 5
- 35
- 65
5
votes
2 answers
How to suppress warnings in Swift 3?
Using clang* I could do
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// ...
#pragma clang diagnostic pop
However this does not work in swift.
So how to do suppress warnings in Swift?
![](../../users/profiles/6478090.webp)
Meniny
- 570
- 5
- 18
3
votes
2 answers
Swift 3.1: Cannot convert value of type '(_) -> ()' error / Problems with closures
I upgraded to Swift 3.1, and I'm getting a few new errors that seem to be 3.1 syntax problems, as they weren't an issue before migration. Mostly they are related to closures, as in this example:
let alert = UIAlertController(title: "Success",…
![](../../users/profiles/5476481.webp)
Jacobo Koenig
- 5,758
- 5
- 30
- 54
3
votes
3 answers
Text in UIView Border
I am currently working on a project in iOS (using XCode and Swift). I am trying to implement the following UITextFields for the login view:
I was thinking of different ways to go about doing this and they all seem complicated. It would be amazing…
![](../../users/profiles/5493076.webp)
Kevin Rajan
- 777
- 7
- 25
3
votes
2 answers
Swift 3.0: "objc_setAssociatedObject" issue
import UIKit
import ObjectiveC
var SubRowObjectKey: String = "subRow"
extension IndexPath {
var subRow: Int {
get {
let subRowObj = objc_getAssociatedObject(self, &SubRowObjectKey)
if subRowObj != nil…
![](../../users/profiles/4034103.webp)
Rahul
- 83
- 9
2
votes
0 answers
What's the proper way to animate one constraint of a UIView?
I have created a view ('attributeView') with constraints:
NSLayoutConstraint.activate([
attributeView!.topAnchor.constraint(equalTo: containerView!.topAnchor, constant: 1),
attributeView!.widthAnchor.constraint(equalToConstant:320.0),
…
![](../../users/profiles/715747.webp)
Frederick C. Lee
- 7,609
- 13
- 56
- 89
2
votes
0 answers
Array extension for generic items - protocol not convertible to parent protocol
The code:
protocol AProtocol {}
protocol ABProtocol: AProtocol {}
struct ABStruct: ABProtocol {}
struct Wrapper {
let object: T
}
extension Array where Element == Wrapper {
func merge(with otherArray: [Element]) {}
}
let…
![](../../users/profiles/229229.webp)
Lukasz
- 19,014
- 15
- 77
- 136
2
votes
2 answers
How to navigate another view controller when clicking on item inside cell of collectionView Using Swift 3
We want to show another controller by replacing main controller when clicking on item (i.e ImageView) inside a cell collection. But we are not able to get main collection view and can't able to navigate targeted controller. We are using following…
![](../../users/profiles/5680724.webp)
kishu mewara
- 2,434
- 11
- 27
2
votes
0 answers
Orientation management in UINavigationController in iOS 10
I have a very simple app, 3 UIViewControllers in UINavigationController:
I wish the first 2 UIViewControllers to work only in portrait orientation and the last one to work only in landscape one.
I subclassed UINavigation controller and I overrided…
![](../../users/profiles/1498493.webp)
Greg
- 24,353
- 5
- 47
- 60
1
vote
0 answers
Delegation from Auth0 to Firebase does not function
I have a firebase app. Authentication provider is Auth0, all my users are residing in auth0. I am trying to login with auth0 and than with delegation creating a jwt token to use in firebase. But from firebase I am getting an error.
The error is…
![](../../users/profiles/1595224.webp)
i-developer
- 431
- 4
- 12
1
vote
0 answers
Computed property used in local scope causes 'command failed due to signal segmentation fault...?
I used the code below in Swift 3 and it worked fine ...
func postObject(toCategories categories: [String], object: Object){
var postedToCategory: Bool {
if categories.count > 1 {
return true
} else if categories[0]…
![](../../users/profiles/5544696.webp)
MikeG
- 3,006
- 1
- 24
- 48
1
vote
1 answer
Does _ArrayType or _ArrayProtocol not available in Swift 3.1?
I was using _ArrayType in my project when I was running on swift 2.1. I upgraded to swift 3.0.2 (Xcode 8.2.1) last week and I found here that _ArrayType is changed to _ArrayProtocol and it was working well.
Today I upgraded my Xcode to 8.3.1, and it…
![](../../users/profiles/493476.webp)
Kapil Choubisa
- 4,970
- 8
- 59
- 99
1
vote
1 answer
Realm for Swift 3.1 - Command failed due to signal: Illegal instruction: 4
After updating Swift to v3.1, I got Realm frameworks replaced by the new version downloaded from Realm Swift 2.5.1 but get the following issue:
Command failed due to signal: Illegal instruction: 4
Already checked this and this, but they didn't…
![](../../users/profiles/7113238.webp)
Lawliet
- 3,212
- 1
- 14
- 25
1
vote
1 answer
Call Array.reduce(_:_) from enumerated array
Normal reduce call:
[1,2,3].reduce(0, { cur, val in
return val
})
Attempt at calling reduce from an EnumeratedSequence>:
[1,2,3].enumerated().reduce(0, { cur, (index, element) in
return element
})
// Error:…
![](../../users/profiles/1419236.webp)
RobertJoseph
- 7,336
- 9
- 58
- 100