iOS Apester Kit
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ApesterKit.xcodeproj
ApesterKit.xcworkspace
ApisterKitDemo
ApisterKitDemoTests
Sources
Tests
docs
scripts
.gitignore
.swift-version
.travis.yml
ApesterKit.podspec
Cartfile
Cartfile.private
Cartfile.resolved
LICENSE
Package.swift
Readme.md

Readme.md

ApesterKit

Platforms License

Swift Package Manager Carthage compatible CocoaPods compatible

ApesterKit provides a light-weight framework that loads Apester Unit in a webView

Requirements

  • iOS 8.0+
  • Xcode .0+

Installation

CocoaPods

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 1.2+.

To integrate ApesterKit into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'```

use_frameworks!

pod 'ApesterKit', '~> 1.2'

Then, run the following command:

$ pod install

Carthage

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" ~> 1.2

Then, run the following command:

$ carthage update --platform iOS --use-submodules

Manually

If you prefer not to use either of the aforementioned dependency managers, you can integrate ApesterKit into your project manually.

Git Submodules

  • 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 the ApesterKit.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 the ApesterKit.framework nested inside a Products 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.

Implementaion

1 - register the app main bundle and the webView, In your viewController viewDidLoad function:

APEWebViewService.shared.register(bundle: Bundle.main, webView: webView, unitHeightHandler: { [weak self] result in
switch result {
case .success(let height):
print(height)
case .failure(let err):
print(err)
}})

2 - pass the device advertising params and get the apester unit height update by calling didStartLoad and didFinishLoad:

• UIWebView Case:

extension ViewController: UIWebViewDelegate {
func webViewDidStartLoad(_ webView: UIWebView) {
APEWebViewService.shared.didStartLoad(webView: webView)
}

func webViewDidFinishLoad(_ webView: UIWebView) {
APEWebViewService.shared.didFinishLoad(webView: webView)
}
}

• WKWebView Case:

extension ViewController: WKNavigationDelegate {
func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
APEWebViewService.shared.didStartLoad(webView: webView)
}

func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
APEWebViewService.shared.didFinishLoad(webView: webView)
}
}

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.

Read More About ApesterKit...

License

ApesterKit is released under the MIT license. See LICENSE for details.