carson-katri / swift-request

Declarative HTTP networking, designed for SwiftUI
MIT License
727 stars 41 forks source link

Merge two Url with + operator #36

Closed o-nnerb closed 3 years ago

o-nnerb commented 3 years ago

I would like to add two URL to create a new one, for example:

Url("https://example.com/api/v1") + Url("/settings")

But, I believe that we can add one Url with a string too like that:

func + (_ url: Url, _ complementary: String) -> Url { Url("\(url.value ?? "")\(complementary)") }

carson-katri commented 3 years ago

Great suggestion, feel free to make a PR. I agree that Url + String and Url + Url would be good.