Skip to content

Commit

Permalink
Swift 2 updated
Browse files Browse the repository at this point in the history
Updated Panoramic control to be compatible with Swift 2.
  • Loading branch information
iSame7 committed Oct 27, 2015
1 parent bc35228 commit 21aba06
Show file tree
Hide file tree
Showing 14 changed files with 236 additions and 238 deletions.
237 changes: 123 additions & 114 deletions Panoramic/Panoramic.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {

},
"DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
"D359FF3C54B1BAF14FF22A745D45A8C0CA649396" : 0
},
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "9E50FD57-17B8-4739-907B-CD1BBEC451FB",
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
"D359FF3C54B1BAF14FF22A745D45A8C0CA649396" : "Panoramic\/Panoramic\/"
},
"DVTSourceControlWorkspaceBlueprintNameKey" : "Panoramic",
"DVTSourceControlWorkspaceBlueprintVersion" : 204,
"DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "Panoramic.xcodeproj",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/iSame7\/Panoramic.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "D359FF3C54B1BAF14FF22A745D45A8C0CA649396"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/iSame7\/Panoramic.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "D359FF3C54B1BAF14FF22A745D45A8C0CA649396"
}
]
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0620"
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -14,7 +14,7 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "29C36C481A409688006A83A2"
BlueprintIdentifier = "29C36B461A3F5FC9006A83A2"
BuildableName = "Panoramic.app"
BlueprintName = "Panoramic"
ReferencedContainer = "container:Panoramic.xcodeproj">
Expand All @@ -28,7 +28,7 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "29C36C5D1A409688006A83A2"
BlueprintIdentifier = "29C36B5B1A3F5FC9006A83A2"
BuildableName = "PanoramicTests.xctest"
BlueprintName = "PanoramicTests"
ReferencedContainer = "container:Panoramic.xcodeproj">
Expand All @@ -37,16 +37,16 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "29C36C5D1A409688006A83A2"
BlueprintIdentifier = "29C36B5B1A3F5FC9006A83A2"
BuildableName = "PanoramicTests.xctest"
BlueprintName = "PanoramicTests"
ReferencedContainer = "container:Panoramic.xcodeproj">
Expand All @@ -56,27 +56,30 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "29C36C481A409688006A83A2"
BlueprintIdentifier = "29C36B461A3F5FC9006A83A2"
BuildableName = "Panoramic.app"
BlueprintName = "Panoramic"
ReferencedContainer = "container:Panoramic.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "29C36C481A409688006A83A2"
BlueprintIdentifier = "29C36B461A3F5FC9006A83A2"
BuildableName = "Panoramic.app"
BlueprintName = "Panoramic"
ReferencedContainer = "container:Panoramic.xcodeproj">
Expand All @@ -86,16 +89,16 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "29C36C481A409688006A83A2"
BlueprintIdentifier = "29C36B461A3F5FC9006A83A2"
BuildableName = "Panoramic.app"
BlueprintName = "Panoramic"
ReferencedContainer = "container:Panoramic.xcodeproj">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>29C36C481A409688006A83A2</key>
<key>29C36B461A3F5FC9006A83A2</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>29C36C5D1A409688006A83A2</key>
<key>29C36B5B1A3F5FC9006A83A2</key>
<dict>
<key>primary</key>
<true/>
Expand Down
4 changes: 2 additions & 2 deletions Panoramic/Panoramic/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// AppDelegate.swift
// Panoramic
//
// Created by Sameh Mabrouk on 12/16/14.
// Created by Sameh Mabrouk on 12/15/14.
// Copyright (c) 2014 SMApps. All rights reserved.
//

Expand All @@ -15,7 +15,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
var panoramaVC : PanoramaViewController? = PanoramaViewController()
let panoramaVC : PanoramaViewController? = PanoramaViewController()
window = UIWindow(frame: UIScreen.mainScreen().bounds)
if let window = window {
window.backgroundColor = UIColor.orangeColor()
Expand Down
2 changes: 1 addition & 1 deletion Panoramic/Panoramic/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.smapps.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
17 changes: 9 additions & 8 deletions Panoramic/Panoramic/PanoramaIndicator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ extension UIScrollView{

//MARK: Getters/Setters
func setViewForPanoramaIndicator(viewScrollIndicator:UIView){
objc_setAssociatedObject(self, &viewScrollIndicatorKey, viewScrollIndicator, UInt(OBJC_ASSOCIATION_RETAIN_NONATOMIC))
objc_setAssociatedObject(self, &viewScrollIndicatorKey, viewScrollIndicator, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}

func getViewForPanoramaIndicator() -> UIView?{
Expand All @@ -30,7 +30,8 @@ extension UIScrollView{
}
func setBackgroundViewForPanoramaIndicator(backgroundViewScrollIndicator:UIView){

objc_setAssociatedObject(self, &backgroundViewScrollIndicatorKey, backgroundViewScrollIndicator, UInt(OBJC_ASSOCIATION_RETAIN_NONATOMIC))
objc_setAssociatedObject(self, &backgroundViewScrollIndicatorKey, backgroundViewScrollIndicator, .OBJC_ASSOCIATION_RETAIN)
objc_setAssociatedObject(dismissed, &key, nil, .OBJC_ASSOCIATION_RETAIN)

}
func getBackgroundViewForPanoramaIndicator()-> UIView?{
Expand Down Expand Up @@ -85,7 +86,7 @@ extension UIScrollView{
func refreshBackgroundPanoramaIndicator(){

let backgroundViewScrollIndicator:UIView = self.getBackgroundViewForPanoramaIndicator()!
var x:CGFloat = self.contentOffset.x + ScrollIndicatorLeftRightThreshold
let x:CGFloat = self.contentOffset.x + ScrollIndicatorLeftRightThreshold
let rect:CGRect = CGRect(x: x, y: backgroundViewScrollIndicator.frame.origin.y, width: backgroundViewScrollIndicator.frame.width, height: backgroundViewScrollIndicator.frame.height)
backgroundViewScrollIndicator.frame = rect
}
Expand All @@ -94,14 +95,14 @@ extension UIScrollView{

let viewScrollIndicator:UIView = self.getViewForPanoramaIndicator()!
let percent:CGFloat = self.contentOffset.x / self.contentSize.width
var x:CGFloat = self.contentOffset.x + ((self.bounds.size.width - ScrollIndicatorLeftRightThreshold) * percent) + ScrollIndicatorLeftRightThreshold
let x:CGFloat = self.contentOffset.x + ((self.bounds.size.width - ScrollIndicatorLeftRightThreshold) * percent) + ScrollIndicatorLeftRightThreshold
let rect:CGRect = CGRect(x: x, y: viewScrollIndicator.frame.origin.y, width: viewScrollIndicator.frame.width, height: viewScrollIndicator.frame.height)
viewScrollIndicator.frame = rect

}

func disablePanoramaIndicator(){
println("disablePanoramaIndicator")
print("disablePanoramaIndicator")
self.stopObservers()
self.getBackgroundViewForPanoramaIndicator()?.removeFromSuperview()
self.getViewForPanoramaIndicator()?.removeFromSuperview()
Expand All @@ -110,8 +111,8 @@ extension UIScrollView{
//MARK: KVO
func setupObservers(){

self.addObserver(self, forKeyPath:"contentSize", options: NSKeyValueObservingOptions.New | NSKeyValueObservingOptions.Old , context: nil)
self.addObserver(self, forKeyPath:"contentOffset", options: NSKeyValueObservingOptions.New | NSKeyValueObservingOptions.Old , context: nil)
self.addObserver(self, forKeyPath:"contentSize", options: [NSKeyValueObservingOptions.New, NSKeyValueObservingOptions.Old] , context: nil)
self.addObserver(self, forKeyPath:"contentOffset", options: [NSKeyValueObservingOptions.New, NSKeyValueObservingOptions.Old] , context: nil)
}

func stopObservers(){
Expand All @@ -121,7 +122,7 @@ extension UIScrollView{

}

override public func observeValueForKeyPath(keyPath: String, ofObject object: AnyObject, change: [NSObject : AnyObject], context: UnsafeMutablePointer<Void>) {
override public func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutablePointer<Void>) {

if self.contentSize.width > 0.0{

Expand Down
Loading

0 comments on commit 21aba06

Please sign in to comment.