-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify and refactor #2691
Simplify and refactor #2691
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Some of the changes go against some intentional design decisions but I think some of the other can be merged with changes.
@@ -109,7 +109,7 @@ extension DataRequest { | |||
/// - completionHandler: The code to be executed once the request has finished. | |||
/// - Returns: The request. | |||
@discardableResult | |||
public func response(queue: DispatchQueue? = nil, completionHandler: @escaping (DataResponse<Data?>) -> Void) -> Self { | |||
public func response(queue: DispatchQueue = .main, completionHandler: @escaping (DataResponse<Data?>) -> Void) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're going to make this change, it would be good to audit all API that takes optional values with a coalesced value in the body, and change them all to work like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I saw, I couldn't find any similar case to this.
} | ||
} | ||
} | ||
|
||
// MARK: Properties | ||
|
||
/// Returns a default `URLEncoding` instance. | ||
/// Returns a default `URLEncoding` instance with a `.methodDependent` destination. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this one. Perhaps keeping default
and adding an httpBody
convenience property?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not understanding your comment. I need more context. What is the issue about?
Thank you for your response @jshier. I will try to address your comments as soon as possible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should reevaluate these changes after beta 2 is released, as there will likely need to be some updates.
Thanks for putting this all together @jdisho. I'm going to take a stab at putting together a different PR with most of these changes while keeping your attribution. I'll link the new PR once it's up. |
Hi @jdisho, I just pushed up #2765 which pulls in these changes, culls out a few of them, and rebases on top of the #2716 PR. I made sure to maintain your attribution to the changeset. I'm going to go ahead and close out this PR for now. Please redirect all further comments to #2765. These changes will go out as part of AF5 beta 4. Cheers. π» |
This is my first PR. First of all, I want to thank you for your time investment in
Alamofire
. Amazing lib πGoals β½
Simplifying and refactoring some basic things.
Implementation Details π§
switch
statements. Theswitch
cases which are simplified are 2 case statements and can we simplified by usingguard
..main
rather thannil
. I did this because under the hood,.main
is used when the queue value isnil
.methodDependent
property inParameterEncoding
since it is a duplication ofdefault
. (If there is a reason whymethodDependent
anddefault
are included, I would be interested to know why π)encodesParametersInURL
inParameterEncoding
by making it part ofDestination
. (I occurred that in the same wayencodesParametersInURL
is implemented inParameterEncoder
)