Skip to content

Conversation

@TiagoMaiaL
Copy link
Contributor

@TiagoMaiaL TiagoMaiaL commented Sep 11, 2021

Goals ⚽

Fix the title of the DetailViewController, in the iOS sample app. It permanently displays the following title: No request created yet., even after the test request is performed (more context in the gif files).

This happens because the title is changed too early, before the internal URLRequest gets configured (which is used in the description property).

To fix this issue, the controller now assigns a closure to the onURLRequestCreation method on the Request type. Inside this closure, it updates its title.

Before the change:

After the change:

@jshier
Copy link
Contributor

jshier commented Sep 19, 2021

Thanks for the PR, this something we've wanted to fix for a while. However, your approach, while it works now, is still racy with the actual creation of the URLRequest used create the description. A more correct solution would be adding an onURLRequestCreation closure to the passed Request and using that value to set the title. Once that's changed, I think we can merge this.

@jshier jshier self-assigned this Sep 19, 2021
@jshier jshier added the bug label Sep 19, 2021
@TiagoMaiaL TiagoMaiaL force-pushed the fix-request-title-ios-sample branch from ca4e953 to 385e1b5 Compare September 19, 2021 16:56
@TiagoMaiaL
Copy link
Contributor Author

TiagoMaiaL commented Sep 19, 2021

@jshier Thanks for your reply. I just amended the commit with the suggested change.

@jshier
Copy link
Contributor

jshier commented Sep 20, 2021

Thanks!

@jshier jshier merged commit aeb3214 into Alamofire:master Sep 20, 2021
@jshier jshier added this to the 5.4.4 milestone Sep 20, 2021
jshier added a commit that referenced this pull request Sep 20, 2021
* Version to 5.4.4.

* Update Ruby dependencies.

* Update Jazzy docs.

* Fix the screen title for each request in the sample app (#3494)

* Add one more PR.

Co-authored-by: Tiago Maia <tiago.maia.lopes@gmail.com>
@TiagoMaiaL TiagoMaiaL deleted the fix-request-title-ios-sample branch September 22, 2021 13:17
jshier added a commit that referenced this pull request Jan 15, 2022
* Version to 5.4.4.

* Update Ruby dependencies.

* Update Jazzy docs.

* Fix the screen title for each request in the sample app (#3494)

* Add one more PR.

Co-authored-by: Tiago Maia <tiago.maia.lopes@gmail.com>
prongbang pushed a commit to prongbang/Alamofire that referenced this pull request May 23, 2025
prongbang pushed a commit to prongbang/Alamofire that referenced this pull request May 23, 2025
* Version to 5.4.4.

* Update Ruby dependencies.

* Update Jazzy docs.

* Fix the screen title for each request in the sample app (Alamofire#3494)

* Add one more PR.

Co-authored-by: Tiago Maia <tiago.maia.lopes@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants