Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Latest commit

 

History

History
119 lines (83 loc) · 3.01 KB

README.md

File metadata and controls

119 lines (83 loc) · 3.01 KB

Panframe iOS SDK Wrapper

This wrappers makes Panframe iOS SDK play nice with Swift and brings familiar Objctive-C patterns to the SDK. It also uses modern NS_ASSUME_NONNULL_BEGIN, NS_ASSUME_NONNULL_END, __nullable, NS_DESIGNATED_INITIALIZER macros to make the wrapper Swift-er.

NOTE: You still need to signup and download the Panframe iOS SDK from their website to use this wrapper. This is NOT a re-write of their SDK.

Installation

You have two options to include the PanframeSDKWrapper in your project:

Podfile

pod "PanframeSDKWrapper", "~> 1.0"

Manual Installation

Drag the following classes from the Source folder directly into your project:

  • PanframeSDKWrapper.h
  • PanframeSDKWrapper.m

Classes

Swift Friendly Enums

enum PanframeAssetMessage: Int {
    case Loaded, Playing, Paused, Stopped, Complete, Downloading, Downloaded, DownloadCancelled, Error, Seeking           
}

enum PanframeNavigationMode: Int {
    case Motion, Touch
}

enum PanframeViewMode: Int {
    case Flat, Sphere
}

enum PanframeBlindSpotLocation: Int {
    case None, Top, Bottom
}

PanframeView replaces PFView

Objc

// Before: PFView init
PFView *pfView = [PFObjectFactory viewWithFrame:[self.view bounds]];

// After: PanframeView init
PanframeView *pfView = [[PanframeView alloc] initWithFrame:[self.view bounds]];

Swift

// Before: PFView init
let pfView = PFObjectFactory.viewWithFrame(view.bounds)

// After: PanframeView init
let pfView = PanframeView(frame: view.bounds)

PanframeAsset replaces PFAsset

Objc

// Before: PFAsset init
PFAsset *asset = (id<PFAsset>)[PFObjectFactory assetFromUrl:url observer:(PFAssetObserver*)self];

// After: PanframeAsset init
PanframeAsset *asset = [[PanframeAsset alloc] initWithUrl:url observer:self];

Swift

// Before: PFAsset init
Not available in Swift. uh oh.

// After: PanframeAsset init
let asset = PanframeAsset(url, observer: self)

PanframeAssetObserver replaces both PFAssetObserver and PFAssetTimeMonitor protocols.

@interface PanoViewController : UIViewController <PanframeAssetObserver>
@end

@implementation PanoViewController
- (void)panframeAsset:(PanframeAsset * __nonnull)asset onPlayerTime:(CMTime)time
{
}

- (void)panframeAsset:(PanframeAsset * __nonnull)asset onStatusMessage:(PanframeAssetMessage)message
{
}
@end
class PanoViewController: UIViewController, PanframeAssetObserver {

    func panframeAsset(asset: PanframeAsset, onPlayerTime time: CMTime) {
    }

    func panframeAsset(asset: PanframeAsset, onStatusMessage message: PanframeAssetMessage) {
    }

}

Author

License

PanframeSDKWrapper is released under the MIT license. See LICENSE for details. Panframe trademark and technology is the property of their respective owners.