Bug tracker component in Swift to add in iOS apps (internal use).
- In your Xcode project, go to: File > Swift Packages > Add Package Dependency…
- Enter the package URL:
git@github.com:Infomaniak/ios-bug-tracker.git
Before presenting the bug tracker, you need to configure it:
BugTrackerInfo(
route: "route", // route to find the project bucket (optional)
project: "app-mobile-mail", // project name
serviceId: 0 // service ID to find the project bucket (optional)
)
The bug tracker component can only be used by staff accounts. To check this, use the isStaff
property of the UserProfile
object (from InfomaniakCore package).
Note: the token needs the user_info_staff
scope to be able to fetch this property.
To present the bug tracker component using SwiftUI, simply return a BugTrackerView
in a sheet
or NavigationLink
.
struct MyView: View {
@State private var showingBugTracker = false
var body: some View {
VStack {
Text("My view")
Button("Present bug tracker") {
showingBugTracker = true
}
}
.sheet(isPresented: $showingBugTracker) {
BugTrackerView(isPresented: $showingBugTracker)
}
}
}
To present the bug tracker component using UIKit, simply present a BugTrackerViewController
instance.
myViewController.present(BugTrackerViewController(), animated: true)