Beagle v1.5 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: First things first, we are going to be using a view code approach here, so we need to delete all references to main.storyboard, which is the way that Xcode usually set your project to initialize. These references are localized at:
Delete these three. The third one you have to erase and confirm.
Step 3: Add BeagleScaffold as a dependency of your project using CocoaPods:
target 'MyApp' do
pod 'BeagleScaffold'
end
If you’re not familiar with CocoaPods, check their documentation.
Also add the YogaKit dependency to your project via CocoaPods, but point to our repo because we need some changes that weren’t merged on their official repository. Like so:
pod 'YogaKit', :git => 'https://github.com/ZupIT/YogaKit'
BeagleScaffold has default implementations of a Network layer, Cache and Logger for you, embedded in BeagleDefaults.
Step 4: To add Beagle configurations to your application, 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 5: Now for the last step to run the application, we’re going to do the “view code” section 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)
Import BeagleScaffold
.
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 6: 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.