Beagle v1.7 is no longer actively maintained. The documented version you are viewing may contain deprecated functionality. For up-to-date documentation, see the latest version .
It’s recommended for beginners.
This tutorial will configure Beagle from the Start.
Step 1: Create a new app project using Xcode.
Step 2: Use pod init
command in your terminal to create a Podfile and add Beagle Scaffold as a dependency to your project:
target 'MyApp' do
pod 'BeagleScaffold'
end
If you’re not familiar with CocoaPods, check their documentation.
BeagleScaffold has default implementations of a Network layer, Cache and Logger for you, embedded in BeagleDefaults.
Step 3: To add Beagle configurations to your application, import the lib BeagleScaffold
and just call our function named start()
from the class BeagleConfig
, in your SceneDelegate
inside the method scene()
:
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
BeagleConfig.start()
guard let _ = (scene as? UIWindowScene) else { return }
}
Step 4: Now for the last step to run the application, we’re going to do our project initialization using View Code here.
Still in the method scene
, give the name windowScene
to the guard let
already created for us by Xcode:
guard let windowScene = (scene as? UIWindowScene) else { return }
Initialize the variable window
created outside the function scope, using our windowScene
:
window = UIWindow(windowScene: windowScene)
Make the window.rootViewController
our BeagleScaffoldDemoViewController
and call the method makeKeyAndVisible()
. Your code should be like this:
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
BeagleConfig.start()
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(windowScene: windowScene)
window?.rootViewController = BeagleScaffoldDemoViewController
window?.makeKeyAndVisible()
}
Step 5: Run your project, and you should see a sample screen with all Beagle components on your simulator.
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.