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.
You have two options to include the PanframeSDKWrapper
in your project:
pod "PanframeSDKWrapper", "~> 1.0"
Drag the following classes from the Source folder directly into your project:
PanframeSDKWrapper.h
PanframeSDKWrapper.m
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
// Before: PFView init
PFView *pfView = [PFObjectFactory viewWithFrame:[self.view bounds]];
// After: PanframeView init
PanframeView *pfView = [[PanframeView alloc] initWithFrame:[self.view bounds]];
// Before: PFView init
let pfView = PFObjectFactory.viewWithFrame(view.bounds)
// After: PanframeView init
let pfView = PanframeView(frame: view.bounds)
PanframeAsset
replaces PFAsset
// Before: PFAsset init
PFAsset *asset = (id<PFAsset>)[PFObjectFactory assetFromUrl:url observer:(PFAssetObserver*)self];
// After: PanframeAsset init
PanframeAsset *asset = [[PanframeAsset alloc] initWithUrl:url observer:self];
// 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) {
}
}
PanframeSDKWrapper is released under the MIT license. See LICENSE for details. Panframe trademark and technology is the property of their respective owners.