Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
scihant committed Sep 21, 2017
2 parents 3c8b9c3 + eea5b8f commit ca632e1
Show file tree
Hide file tree
Showing 13 changed files with 76 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0
4.0
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode8.2
osx_image: xcode9
cache: bundler
env:
global:
Expand All @@ -9,7 +9,7 @@ env:
- EXAMPLE_SCHEME=Example
- SDK=iphonesimulator
matrix:
- DESTINATION="OS=10.1,name=iPhone 7" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES"
- DESTINATION="OS=11.0,name=iPhone 7" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES"
- DESTINATION="OS=9.3,name=iPhone 6" RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO"
- DESTINATION="OS=8.4,name=iPhone 4S" RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO"
before_install:
Expand Down
2 changes: 1 addition & 1 deletion CTPanoramaView.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "CTPanoramaView"
s.version = "1.0"
s.version = "1.1"
s.summary = "Displays spherical or cylindrical panoramas and 360 photos with touch or motion based controls."
s.homepage = "https://github.com/scihant/CTPanoramaView"
s.screenshots = "https://cloud.githubusercontent.com/assets/3991481/23154113/ce5aa6b8-f814-11e6-9c97-4d91629733f8.gif", "https://cloud.githubusercontent.com/assets/3991481/23154919/d5f98476-f818-11e6-8c71-22011a027d96.jpg"
Expand Down
8 changes: 5 additions & 3 deletions CTPanoramaView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
CF415AAA1E55C70F002A98ED = {
CreatedOnToolsVersion = 8.2.1;
DevelopmentTeam = 38P3Q4228V;
LastSwiftMigration = 0820;
LastSwiftMigration = 0900;
ProvisioningStyle = Automatic;
};
CF415AB31E55C70F002A98ED = {
Expand Down Expand Up @@ -356,7 +356,8 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -376,7 +377,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.scihant.CTPanoramaView;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -55,6 +56,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
23 changes: 20 additions & 3 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,13 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0820;
LastUpgradeCheck = 0820;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = scihant;
TargetAttributes = {
CF415ADD1E55E314002A98ED = {
CreatedOnToolsVersion = 8.2.1;
DevelopmentTeam = 38P3Q4228V;
LastSwiftMigration = 0900;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -271,15 +272,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -308,6 +315,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
};
name = Debug;
};
Expand All @@ -320,15 +328,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand All @@ -349,6 +363,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -363,7 +378,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.scihant.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -377,7 +393,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.scihant.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -45,6 +46,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
17 changes: 6 additions & 11 deletions Example/Example/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -33,11 +33,8 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="NdB-jE-HZg">
<rect key="frame" x="256" y="30" width="109" height="30"/>
<rect key="frame" x="271" y="30" width="94" height="30"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="width" constant="109" id="r8D-VE-6iq"/>
</constraints>
<state key="normal" title="Touch/Motion">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
Expand All @@ -50,12 +47,9 @@
<action selector="motionTypeTapped" destination="BYZ-38-t0r" eventType="touchUpInside" id="K2u-h8-ENc"/>
</connections>
</button>
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="zyS-cK-YJl">
<rect key="frame" x="10" y="30" width="167" height="30"/>
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" horizontalCompressionResistancePriority="751" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="zyS-cK-YJl">
<rect key="frame" x="10" y="30" width="149" height="30"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="width" constant="167" id="G2F-vr-2Xj"/>
</constraints>
<state key="normal" title="Spherical / Cylindrical">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
Expand Down Expand Up @@ -84,6 +78,7 @@
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="C0u-qY-bwX" secondAttribute="bottom" id="LnI-TD-CPd"/>
<constraint firstItem="NdB-jE-HZg" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="10" id="OrN-Pp-ovw"/>
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="aFO-BR-VR0" secondAttribute="bottom" constant="10" id="bM7-M1-9CN"/>
<constraint firstItem="NdB-jE-HZg" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="zyS-cK-YJl" secondAttribute="trailing" constant="100" id="dVh-rC-bsH"/>
<constraint firstItem="C0u-qY-bwX" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" id="gzc-Uw-gNs"/>
<constraint firstAttribute="trailing" secondItem="aFO-BR-VR0" secondAttribute="trailing" constant="10" id="ily-cn-fnE"/>
<constraint firstItem="C0u-qY-bwX" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="jGp-7q-EyJ"/>
Expand Down
2 changes: 1 addition & 1 deletion Example/Example/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.1</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ CTPanoramaView is a high-performance library that uses SceneKit to display compl
## Requirements

* iOS 8.0+
* Xcode 8.0+
* Swift 3.0+
* v1.0 requires Xcode 8.0 and Swift 3.0
* v1.1 requires XCode 9.0 and Swift 4.0

CTPanoramaView can be used both from Objective-C and Swift code.

Expand Down
45 changes: 30 additions & 15 deletions Source/CTPanoramaView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,36 @@ import ImageIO

// MARK: Public properties

public var panSpeed = CGPoint(x: 0.005, y: 0.005)
@objc public var panSpeed = CGPoint(x: 0.005, y: 0.005)

public var image: UIImage? {
@objc public var image: UIImage? {
didSet {
panoramaType = panoramaTypeForCurrentImage
}
}

public var overlayView: UIView? {
@objc public var overlayView: UIView? {
didSet {
replace(overlayView: oldValue, with: overlayView)
}
}

public var panoramaType: CTPanoramaType = .cylindrical {
@objc public var panoramaType: CTPanoramaType = .cylindrical {
didSet {
createGeometryNode()
resetCameraAngles()
}
}

public var controlMethod: CTPanoramaControlMethod! {
@objc public var controlMethod: CTPanoramaControlMethod = .touch {
didSet {
switchControlMethod(to: controlMethod!)
switchControlMethod(to: controlMethod)
resetCameraAngles()
}
}

public var compass: CTPanoramaCompass?
public var movementHandler: ((_ rotationAngle: CGFloat, _ fieldOfViewAngle: CGFloat) -> ())?
@objc public var compass: CTPanoramaCompass?
@objc public var movementHandler: ((_ rotationAngle: CGFloat, _ fieldOfViewAngle: CGFloat) -> ())?

// MARK: Private properties

Expand All @@ -73,17 +73,33 @@ import ImageIO
private lazy var cameraNode: SCNNode = {
let node = SCNNode()
let camera = SCNCamera()
camera.yFov = 70
node.camera = camera
return node
}()

private lazy var fovHeight: CGFloat = {
return CGFloat(tan(self.cameraNode.camera!.yFov/2 * .pi / 180.0)) * 2 * self.radius
return tan(yFov/2 * .pi / 180.0) * 2 * self.radius
}()

private var xFov: CGFloat {
return CGFloat(self.cameraNode.camera!.yFov) * self.bounds.width / self.bounds.height
return yFov * self.bounds.width / self.bounds.height
}

private var yFov : CGFloat {
get {
if #available(iOS 11.0, *) {
return cameraNode.camera!.fieldOfView
} else {
return CGFloat(cameraNode.camera!.yFov)
}
}
set {
if #available(iOS 11.0, *) {
cameraNode.camera!.fieldOfView = newValue
} else {
cameraNode.camera!.yFov = Double(newValue)
}
}
}

private var panoramaTypeForCurrentImage: CTPanoramaType {
Expand Down Expand Up @@ -122,13 +138,12 @@ import ImageIO
add(view: sceneView)

scene.rootNode.addChildNode(cameraNode)
yFov = 70

sceneView.scene = scene
sceneView.backgroundColor = UIColor.black

if controlMethod == nil {
controlMethod = .touch
}
switchControlMethod(to: controlMethod)
}

// MARK: Configuration helper methods
Expand Down Expand Up @@ -193,7 +208,7 @@ import ImageIO
guard panoramaView.controlMethod == .motion else {return}

guard let motionData = motionData else {
print("\(error?.localizedDescription)")
print("\(String(describing: error?.localizedDescription))")
panoramaView.motionManager.stopDeviceMotionUpdates()
return
}
Expand Down
2 changes: 1 addition & 1 deletion Source/CTPieSliceView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import UIKit

@IBDesignable @objc public class CTPieSliceView: UIView {
@IBDesignable @objcMembers public class CTPieSliceView: UIView {

@IBInspectable var sliceAngle: CGFloat = .pi/2 {
didSet { setNeedsDisplay() }
Expand Down
2 changes: 1 addition & 1 deletion Source/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.1</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down

0 comments on commit ca632e1

Please sign in to comment.