Expected declaration in extension AFError - swift

I'm new to coding, so help is appreciated. I'm getting the error, "expected declaration- in extension of AFError". I'm not sure what I'm doing wrong. It looks right to me. What do I do?

While trying to change the syntax from Swift 2 to Swift 3 the converter destroyed the code of your Alamofire Framework. Always use the correct Framework Versions and don't try to update the code yourself. Also when running the converter, always just run in on your own code. Not on the code of Frameworks.

Related

Swift 4 .symmetricDifference and others are not working

First coding question ever!
So I'm totally new at coding and I'm taking a course in Lynda.com
The course is for swift 4 but there are certain commands that are not working or I have to write it different in order for it to work.
For example
Course says: activeQuest.sorted() Does not work
activeQuest.sort() Does work
Course says: activeQuest.intersection(completedQuests) Does not work
activeQuest.intersect(completedQuests) Does work
.symmetricDifference does not work and couldn't find any other way to write it
Why is this? Thank you!
Why is this?
It’s because the course is for Swift 4 but you are using an earlier version of Swift.

Incorrect method suggestion by Xcode

I am trying to create a directory in my OS X app. The method was suggested as I started typing. But the method seems to be incorrectly suggested. The attributes parameter of the method in NSFileManger normally takes a [FileAttributeKey:Any] dictionary, but here in the suggestion it takes a [String:Any] library.
I checked the NSFileManager APIs and I could not find any like this. Can anyone explain what is happening here?
Your deployment target or your Xcode version is old. FileAttributeKey is new.
https://developer.apple.com/documentation/foundation/fileattributekey

Firebase autocomplete API's cause compiler error Swift

The top line of code is the suggested autocomplete provided by Xcode, which doesn't compile. The bottom piece of code has been modified with code provided here
Firebase with Swift ambiguous use of observeEventType
Everytime I type this code out i have to modify it, which is tedious. Why is the autocomplete wrong? It is not just for this .observe, but all of them.
It seems like your Firebase framework is not the latest version?(as the latest one is now supporting the Swift 3 syntax).
Try pod update.

Only factor methods can have swift_name attribute Mapbox

I'm using cocoa pods and map box was working fine but I installed an update and this message appeared:
Now I can't run my project. I'm using map box iOS sdk 3.3.4. What should I do to fix this issue?
According to apple documentation:
The Swift compiler automatically imports Objective-C code as conventional Swift code. There may be edge cases in your code that are not automatically handled. If you need to change the name imported by Swift of an Objective-C method, enumeration case, or option set value, you can use the NS_SWIFT_NAME macro to customize how a declaration is imported. See more.
So all what I did was delete the implementation of the NS_SWIFT_NAME and with that I was able to build the project. I don't know what made this error appear but this was the best solution I found.
Example:
From this:
- (instancetype)recordWithRPM:(NSUInteger)RPM NS_SWIFT_NAME(init(RPM:));
To this:
- (instancetype)recordWithRPM:(NSUInteger)RPM;

Parse class not created through swift code

I am experiencing an issue when I try to create a new parse class through swift. My code for creating a new class is the following:
let query = PFQuery(className: "newClass")
The issue is that a "newClass" class is not created in my Parse dashboard and I don't get an error message. And since some other code is dependent on retrieving information from this class the app does not function properly.
I have created classes through swift previously and have never run into this problem. I also know that I can create a new class directly through Parse, but that doesn't really help me since there seems to be an issue with the connection between my swift code and Parse.
Thank you in advance for any help!
Is Allow client class creation turned on?
Try using PFObject to create the new class
PFObject(className: "yourNewClass")
I managed to solve it to some extent. After quite some while I got the idea to try to simulate the app on my iPhone instead of only on the simulator that xcode provides. For some reason everything then worked as planned... This is good news for me, but I would like to know why xcode couldn't do it.
Thanks for taking time and giving me some tips Brett!