Moya: Can I not set the baseURL?

Created on 9 May 2018  路  5Comments  路  Source: Moya/Moya

The baseURL of our project is changed. There are several baseURLs, so we can not specify baseURL?

question

All 5 comments

All baseURLs have the same endpoints? @panjiulong

@panjiulong I would make a protocol BaseUrlRepresentable with the baseURL property and then conform all your targets to that. Alternatively you could just provide a default implementation via protocol extension on TargetType if all base URLs are the same

Sent with GitHawk

Like this? @SD10

protocol BaseUrlRepresentable {
      var baseULR1: URL {get}
      var baseULR2: URL {get}
      ...
}

and then

extension GithubAPI: TargetType, BaseUrlRepresentable {
      ....
}

@jdisho if there are two different urls than that works

Sent with GitHawk

@ SD10 @jdisho Thanks!

Was this page helpful?
0 / 5 - 0 ratings