ApesterKit provides a light-weight framework that loads Apester Unit in a webView
- iOS 11.0+
- Xcode 10.2+
Update your app's Info.plist file to add Apester AdMob app ID. (contact Apester to get it).
For testing please use this key:
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string>
A Carousel component for a channel that contains an Apester units of the media publisher. These units were built with Apester Platform, The Carousel component design can be configured and displayed any where. Follow our guide step by step and setup. Follow our guide step by step and setup:
## Swift
private var stripView: APEStripView!
## Objective C
@property (nonatomic, strong) APEStripView *stripView;
2 - initiate a strip style configuration APEStripStyle
. configure the strip view style, i.e shape, size, padding, shadow, title header and more....
## Swift
let header = APEStripHeader(text: "Title", size: 25.0, family: nil, weight: 400, color: .darkText)
let style = APEStripStyle(shape: .roundSquare, size: .medium,
padding: UIEdgeInsets(top: 5.0, left: 0, bottom: 0, right: 0),
shadow: false, textColor: nil, background: nil, header: header)
## Objective C
APEStripHeader *header = [[APEStripHeader alloc] initWithText:@"Title" size:25.0 family:nil weight:400 color:[UIColor purpleColor]];
APEStripStyle *style = [[APEStripStyle alloc] initWithShape:APEStripShapeRoundSquare
size:APEStripSizeMedium
padding:UIEdgeInsetsMake(10.0, 0, 0, 0)
shadow:NO
textColor:nil
background:[UIColor whiteColor]
header:header];
3 - initiate a strip configuration APEStripConfiguration
. set the channel token, style and bundle parameters ....
## Swift
let configuration = try? APEStripConfiguration(channelToken: channelToken,
style: style,
bundle: Bundle.main)
## Objective C
NSError *error = nil;
APEStripConfiguration *config = [[APEStripConfiguration alloc] initWithChannelToken:channelToken
style:style
bundle:[NSBundle mainBundle]
error:&error];
## Swift
self.stripView = APEStripView(configuration: config)
## Objective C
self.stripView = [[APEStripView alloc] initWithConfiguration:config];
## Swift
stripView?.display(in: self.containerView, containerViewController: self)
## Objective C
[self.stripView displayIn:self.containerView containerViewController:self];
## Swift
self.stripView.hide()
## Objective C
[self.stripView hide];
6 - Implemet The APEStripViewDelegate
to observe the stripView updates when success, failure or height updates.
A Unit or playlist component for publisher Apester media. These units were built with Apester Platform.
## Swift
private var unitView: APEUnitView!
## Objective C
@property (nonatomic, strong) APEUnitView *unitView;
## Swift
let unitParams = .unit(mediaId: mediaId)
// OR
let playlistParams = .playlist(tags: tags,
channelToken: channelToken,
context: isContext,
fallback: isFallback)
## Swift
let unitConfig = APEUnitConfiguration(unitParams: unitParams, bundle: Bundle.main)
// OR
let playlistConfig = APEUnitConfiguration(unitParams: playlistParams, bundle: Bundle.main)
## Objective C
APEUnitConfiguration *unitConfig = [[APEUnitConfiguration alloc] initWithMediaId:meidaId bundle: NSBundle.mainBundle];
// OR
APEUnitConfiguration *playlistConfig = [[APEUnitConfiguration alloc] initWithTags: mediaIds
channelToken: channelToken
context: isContext
fallback: isFallback
bundle: NSBundle.mainBundle
gdprString: gdprString
baseUrl: baseUrl];
- set the unit in fullscreen mode (Availble only for story engine)
## Swift
configuration.setFullscreen(true)
## Objective C
[ configuration setFullscreen: true ];
## Swift
self.unitView = APEUnitView(configuration: configuration)
## Objective C
self.unitView = [[APEUnitView alloc] initWithConfiguration:unitConfig];
// OR
self.unitView = [[APEUnitView alloc] initWithConfiguration:playlistConfig];
## Swift
unitView?.display(in: self.containerView, containerViewController: self)
## Objective C
[self.unitView displayIn:self.containerView containerViewController:self];
## Swift
self.unitView.hide()
## Objective C
[self.unitView hide];
## Swift
self.unitView.reload()
## Objective C
[self.unitView reload];
6 - Implemet The APEUnitViewDelegate
to observe the stripView updates when success, failure or height updates.
A service that provides precaching Apester Units, either APEStripView
or APEUnitView
.
## Swift
APEViewService.shared.preloadStripViews(with: configurations)
## Objective C
[APEViewService.shared preloadStripViewsWith: configurations];
## Swift
APEViewService.shared.unloadStripViews(with: channelTokens)
## Objective C
[APEViewService.shared unloadStripViewsWith: channelTokens];
## Swift
APEViewService.shared.stripView(for: channelToken)
## Objective C
[APEViewService.shared stripViewFor: channelToken];
## Swift
APEViewService.shared.preloadUnitViews(with: configurations)
## Objective C
[APEViewService.shared preloadUnitViewsWith: configurations];
## Swift
APEViewService.shared.unloadUnitViews(with: unitIds)
## Objective C
[APEViewService.shared unloadUnitViewsWith: unitIds];
## Swift
APEViewService.shared.unitView(for: unitId)
## Objective C
[APEViewService.shared unitViewFor: unitId];
## Swift
apesterUnitView.subscribe(events: ["apester_interaction_loaded", "click_next"]) // example events
## Objective C
NSArray *events = @[@"apester_interaction_loaded"];
[_apesterUnitView subscribeWithEvents:(NSArray<NSString *> * _Nonnull)events];
Then Implemet The APEStripViewDelegate
- didReciveEvent
to observe the unitView updates when event invoked.
Examples events to subscribed to: (to get more events information contact the Apester team)
Event Name | Meaning |
---|---|
click_next | Next was clicked |
picked_answer | Answer was picked |
unit_started | First engagement |
apester_interaction_loaded | Unit was loaded |
fullscreen_off | Unit full screen closed |
## Swift
apesterUnitView.restart()
## Objective C
[_apesterUnitView restart];
- Preload units so they will open fast
- When Hosting activity is paused/resumed, signal it to the unit.
- Set a "close fullscreen event" so the activity will close itself on click.
## Swift
configuration.setFullscreen(true)
APEViewService.shared.preloadStripViews(with: configurations)
apesterUnitView.subscribe(events: ["fullscreen_off"]) // add more events as needed
apesterUnitView.delegate = self
func unitView(_ unitView: APEUnitView, didReciveEvent name: String, message: String) {
if name == "fullscreen_off" {
finish();
}
}
if #available(iOS 13.0, *) {
NotificationCenter.default.addObserver(self, selector: #selector(willResignActive), name: UIScene.willDeactivateNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(willBackActive), name: UIScene.willEnterForegroundNotification, object: nil)
} else {
NotificationCenter.default.addObserver(self, selector: #selector(willResignActive), name: UIApplication.willResignActiveNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(willBackActive), name: UIApplication.willEnterForegroundNotification, object: nil)
}
@objc func willResignActive(_ notification: Notification) {
apesterUnitView.stop()
}
@objc func willBackActive(_ notification: Notification) {
apesterUnitView.resume()
}
override func viewDidDisappear(_ animated: Bool) {
apesterUnitView.stop()
}
override func viewDidAppear(_ animated: Bool) {
apesterUnitView.resume()
}
The Swift Package Manager automates the distribution of Swift code. To use ApesterKit with SPM, add a dependency to your Package.swift
file:
let package = Package(
dependencies: [
.package(url: "https://github.com/Qmerce/ios-sdk.git", from: "2.0.0")
]
)
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
CocoaPods 1.1.0+ is required to build ApesterKit.
To integrate ApesterKit into your Xcode project using CocoaPods, specify it in your Podfile
:
platform :ios, '11.0'
use_frameworks!
pod 'ApesterKit'
Then, run the following command:
$ pod install
Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.
You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthage
To integrate ApesterKit into your Xcode project using Carthage, specify it in your Cartfile
:
github 'Qmerce/ios-sdk'
Then, run the following command:
$ carthage update --platform iOS --use-submodules
If you prefer not to use either of the aforementioned dependency managers, you can integrate ApesterKit into your project manually.
- Open up Terminal,
cd
into your top-level project directory, and run the following command "if" your project is not initialized as a git repository:
$ git init
- Add ApesterKit as a git submodule by running the following command:
$ git submodule add https://github.com/Qmerce/ios-sdk.git
$ git submodule update --init --recursive
- Open the new
ApesterKit
folder, and drag theApesterKit.xcodeproj
into the Project Navigator of your application's Xcode project.
It should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter.
- Select the
ApesterKit.xcodeproj
in the Project Navigator and verify the deployment target matches that of your application target. - Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the "Targets" heading in the sidebar.
- In the tab bar at the top of that window, open the "General" panel.
- Click on the
+
button under the "Embedded Binaries" section. - You will see two different
ApesterKit.xcodeproj
folders each with two different versions of theApesterKit.framework
nested inside aProducts
folder.
It does not matter which
Products
folder you choose from.
-
Select the
ApesterKit.framework
. -
And that's it!
The
ApesterKit.framework
is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device.
Clone the project and Run the ApesterKitDemo App:
1 - clone it `git clone git@github.com:Qmerce/ios-sdk.git`.
2 - run `carthage update`.
3 - select ApesterKitDemo Target.
4 - run the App and enjoy.
ApesterKit is released under the MIT license. See LICENSE for details.