Velhotes/Vinyl

How easy is for Alamofire users to integrate Vinyl

RuiAAPeres opened this issue ยท 7 comments

I am unsure if it's quite straightforward, to do this or not, as it stands. I need to actually use Alamofire.

I don't think it's possible, since you deal with the Alamofire's singleton the whole time. Plus the inner NSURLSession it's constant. https://github.com/Alamofire/Alamofire/blob/d409ef6e89bcb98092943492acea81670a155180/Source/Manager.swift#L85 ๐Ÿ‘Ž

via @dmcrodrigues it's possible with:

    public init?(
        session: NSURLSession,
        delegate: SessionDelegate,
        serverTrustPolicyManager: ServerTrustPolicyManager? = nil)
    {
        self.delegate = delegate
        self.session = session

        guard delegate === session.delegate else { return nil }

        commonInit(serverTrustPolicyManager: serverTrustPolicyManager)
    }

Can you elaborate on this a bit? I'm not able to get it working.

Yeah, I don't think that'll work because a Turntables session is nil by default, and the SessionManager's init checks if the session's delegate and the SessionManager's delegate are the same.

Ok. I'm just trying to get a definitive answer if I can use Vinyl for testing with Moya (Alamofire) and there seems to be some conflicting information.

@damianesteban I will come up with an answer soon. I need to investigate a bit more. I haven't used Vinyl in a while. ๐Ÿ˜– Is that cool?

Yes of course ๐Ÿ‘ . Thanks for looking into the issue.