This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum ActiveSheet: Identifiable { | |
case first, second | |
var id: Int { | |
hashValue | |
} | |
} | |
struct YourView: View { | |
@State var activeSheet: ActiveSheet? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// You have a very very large video file you need to upload to a server while your app is backgrounded. | |
// Solve by using URLSession background functionality. I will here use Alamofire to enable multipart upload. | |
class Networking { | |
static let sharedInstance = Networking() | |
public var sessionManager: Alamofire.SessionManager // most of your web service clients will call through sessionManager | |
public var backgroundSessionManager: Alamofire.SessionManager // your web services you intend to keep running when the system backgrounds your app will use this | |
private init() { | |
self.sessionManager = Alamofire.SessionManager(configuration: URLSessionConfiguration.default) | |
self.backgroundSessionManager = Alamofire.SessionManager(configuration: URLSessionConfiguration.background(withIdentifier: "com.lava.app.backgroundtransfer")) |
OlderNewer