Sample example on how to use closure to isolate URLSession dependency for unit testing
The important files are in the "DomainLogic" framework
https://github.com/ekscrypto/sample_urladapter/blob/main/DomainLogic/API.swift https://github.com/ekscrypto/sample_urladapter/blob/main/DomainLogic/API.CatFacts.Breeds.swift https://github.com/ekscrypto/sample_urladapter/blob/main/DomainLogicTests/API.CatFacts.GetBreedsTests.swift
Good luck!