Swiftpack.co - p-x9/AppContainer as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by p-x9.
p-x9/AppContainer 0.0.4
Library that makes it easy to create multiple environments within a single app. You can switch environments without deleting the application.
⭐️ 5
🕓 5 weeks ago
iOS
.package(url: "https://github.com/p-x9/AppContainer.git", from: "0.0.4")

AppContainer

This library allows you to create and manage multiple environments with a single application, just as if you were swapping containers.

This is useful when you want to test multiple accounts in a staging application.

Github issues Github forks Github stars Github top language

Language Switch: 日本語.

Demo

Default Debug1
Default Debug1
Selet Container Container List Container Info
Select List Info

Document

AppGroup

extension AppContainer {
    static let group = .init(groupIdentifier: "YOUR APP GROUP IDENTIFIER")
} 

Methods

Create New Container

let container = try AppContainer.standard.createNewContainer(name: "Debug1")

Get Container List

The original container is named DEFAULT and has a UUID of 00000000-0000-0000-0000-0000-0000-00000000000000000000. You can check it with the property isDefault.

let containers: [Container] = AppContainer.standard.containers

Get Active Container

let activeContainer: Container? = AppContainer.standard.activeContainer

Activate Contrainer

It is recommended to restart the application after calling this method.

try AppContainer.standard.activate(container: container)
try AppContainer.standard.activateContainer(uuid: uuid)

Delete Container

If the container you are deleting is in use, activate the Default container before deleting it.

try AppContainer.standard.delete(container: container)
try AppContainer.standard.deleteContainer(uuid: uuid)

Clean Container

try AppContainer.standard.clean(container: container)
try AppContainer.standard.cleanContainer(uuid: uuid)

Reset

Revert to the state before this library was used. Specifically, the DEFAULT container will be enabled and all other AppContainer-related files will be removed.

try AppContainer.standard.reset()

AppContainerUI

SwiftUI

import AppContainerUI

// show Container List
ContainerListView(appContainer: .standard, title: String = "Containers")

// container info view
ContainerInfoView(appContainer: .standard, container: container)

UIKit

import AppContainerUI

// show Container List
ContainerListViewController(appContainer: .standard, title: String = "Containers")

// container info view
ContainerInfoViewController(appContainer: .standard, container: container)

Licenses

MIT License

GitHub

link
Stars: 7
Last commit: 2 days ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

0.0.4
5 weeks ago

What's Changed

Full Changelog: https://github.com/p-x9/AppContainer/compare/0.0.3...0.0.4

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics