Skip to content

FutureWorkshops/RANDA-RulesOfGolf-iOS-PodRepo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 

Repository files navigation

RANDA-RulesOfGolf-iOS SDK

Rules of Golf SDK allows you to display some elements from The official Rules of Golf app.

Import using Cocoapods

For now the only way to integrate the framework is by using CocoaPods.

Add the repo to your podspecs repositories using the following:

pod repo add RANDA-RulesOfGolf-iOS-PodRepo git@github.com:FutureWorkshops/RANDA-RulesOfGolf-iOS-PodRepo.git

At the top of your Podfile you should have at least these sources:

source 'git@github.com:FutureWorkshops/RANDA-RulesOfGolf-iOS-PodRepo.git'
source 'https://cdn.cocoapods.org/'

Add the following to your Podfile:

pod 'RANDARulesOfGolf'

Add the following post install script, or else the framework won't build. More info here and here.

post_install do | installer |
    installer.pods_project.build_configurations.each do |config|
        config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
    end

    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
        end
        if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
            target.build_configurations.each do |config|
                config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
            end
        end
    end
end

Finally run the following command:

pod install

Adding the license

Rules of Golf framework is a private framework. In order to use it, you need to obtain a license.

To obtain a license, please provide the bundle identifiers of the apps that will use the framework.

This license file randa-rog.license needs to be added to the main bundle of your app.

Screenshot 2023-01-25 at 14 46 52

Using the Rules of Golf framework

Import the framework

Add the following at the top your view controller.

Swift:

import RANDARulesOfGolf

Objective-C:

#import “RANDARulesOfGolf/RANDARulesOfGolf.h”

Changing the language

The ROG Framework will attempt to choose the language based on the supported languages of your app and the user preferences. If that doesn't work you have the option of setting the language yourself.

Swift:

ROGSDK.setLanguage(language: .french)

Objective-C:

[ROGSDK setLanguageWithLanguage:AppLanguageFrench];

Showing screens from the Rules of Golf SDK

The provided screens are native UIViewController subclasses and are designed to be presented modally, i.e. they should cover the UI elements of the hosting app and not be placed within your existing view hierarchy. For example, it is strongly advised not to add the viewControllers to your own instances of UINavigationController or UITabBarController, as the screens themselves are already contained within those classes.

If your app is built using a technology such as Flutter or React Native, please see below for guidance on how to present SDK screens.

Showing the Rules of Golf Tab Bar (including Browse, Search & Learn tabs)

screenshot

Swift:

let rogTabBarController = ROGTabBarController()
self.present(rogTabBarController, animated: true)

Objective-C:

ROGTabBarController *rogTabBarController = [[ROGTabBarController alloc] init];
[self presentViewController:rogTabBarController animated:YES completion:nil];

Or if you want to change the tab order (or show fewer tabs):

Swift:

let rogTabBarController = ROGTabBarController(tabs: [.learn, .browse, .search])
self.present(rogTabBarController, animated: true)

Objective-C:

ROGTabBarController *rogTabBarController = [[ROGTabBarController alloc] initWithTabIdentifiers:@[ROGSDKTabIdentifiers.learn, ROGSDKTabIdentifiers.browse, ROGSDKTabIdentifiers.search]];
[self presentViewController:rogTabBarController animated:YES completion:nil];

Showing just the Rules of Golf Browser Screen

screenshot

Swift:

let rogBrowserNavigationController = ROGBrowserNavigationController()  
self.present(rogBrowserNavigationController, animated: true)

Objective-C:

ROGBrowserNavigationController *rogBrowserNavigationController = [[ROGBrowserNavigationController alloc] init];  
[self presentViewController:rogBrowserNavigationController animated:YES completion:nil];

Showing just the Rules of Golf Search Screen

screenshot

Swift:

let searchNavigationController = ROGSearchNavigationController()  
self.present(searchNavigationController, animated: true)

Objective-C:

ROGSearchNavigationController *searchNavigationController = [[ROGSearchNavigationController alloc] init];  
[self presentViewController: searchNavigationController animated:YES completion:nil];

Showing just the Rules of Golf Learn Screen

screenshot

Swift:

let learnNavigationController = ROGLearnNavigationController()  
self.present(learnNavigationController, animated: true)

Objective-C:

ROGLearnNavigationController * learnNavigationController = [[ROGLearnNavigationController alloc] init];  
[self presentViewController: learnNavigationController animated:YES completion:nil];

Showing screens in Flutter, React Native, etc.

You should avoid trying to host the SDK screens within your own view hierarchies, as you are likely to encounter issues, e.g. with safe area insets. Instead, it is recommended that you present the screens directly on the rootViewController of the application window, which can be achieved by calling the following native code (importing UIKit if necessary):

Swift

let rogTabBarController = ROGTabBarController()
rogTabBarController.modalPresentationStyle = .fullScreen
UIApplication.shared.windows.first?.rootViewController?.present(rogTabBarController, animated: true)

Objective-C:

ROGTabBarController *rogTabBarController = [[ROGTabBarController alloc] init];
rogTabBarController.modalPresentationStyle = UIModalPresentationFullScreen;
UIViewController *rootViewController = [[[[UIApplication sharedApplication] windows] firstObject] rootViewController];
[rootViewController presentViewController:rogTabBarController animated:YES completion:nil];

Note about analytics logging within the SDK

The SDK collects the following anonymous events and sends them to The R&A Firebase Analytics account:

  • New device: Sent the first time the SDK is shown for the current app installation.
  • Session began: Sent when a new session begins.
  • Session ended: Sent when a session is considered to have ended (sent just before the next session begins, as this is the only opportunity we have to determine the session end condition of 30 minutes of inactivity).

You may wish to update the privacy declarations on your store listings to reflect this.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages