Skip to content

Commit

Permalink
Merge pull request hyperoslo#78 from hyperoslo/fix/strong-reference
Browse files Browse the repository at this point in the history
Fix strong reference
  • Loading branch information
zenangst committed Jun 6, 2016
2 parents da39d8a + 597181b commit 8794987
Show file tree
Hide file tree
Showing 11 changed files with 161 additions and 51 deletions.
44 changes: 44 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
opt_in_rules: # some rules are only opt-in
- empty_count
# Find all the available rules by running:
# swiftlint rules
included: # paths to include during linting. `--path` is ignored if present.
- Source
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Carthage
- Pods

# configurable rules can be customized from this configuration file
# binary rules can set their severity level
force_cast: warning # implicitly
force_try:
severity: warning # explicitly
# rules that have both warning and error levels, can set just the warning level
# implicitly
line_length: 200
# they can set both implicitly with an array
type_body_length:
- 300 # warning
- 400 # error
# or they can set both explicitly
file_length:
warning: 500
error: 1200
# naming rules can set warnings/errors for min_length and max_length
# additionally they can set excluded names
type_name:
min_length: 3 # only warning
max_length: # warning and error
warning: 40
error: 50
excluded: iPhone # excluded via string
variable_name:
min_length: # only min_length
error: 2 # only error
excluded: # excluded via string array
- x
- y
- id
- URL
- GlobalAPIKey
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle)
44 changes: 44 additions & 0 deletions Demos/DemoLightbox/.swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
opt_in_rules: # some rules are only opt-in
- empty_count
# Find all the available rules by running:
# swiftlint rules
included: # paths to include during linting. `--path` is ignored if present.
- ../../Source
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Carthage
- Pods

# configurable rules can be customized from this configuration file
# binary rules can set their severity level
force_cast: warning # implicitly
force_try:
severity: warning # explicitly
# rules that have both warning and error levels, can set just the warning level
# implicitly
line_length: 200
# they can set both implicitly with an array
type_body_length:
- 300 # warning
- 400 # error
# or they can set both explicitly
file_length:
warning: 500
error: 1200
# naming rules can set warnings/errors for min_length and max_length
# additionally they can set excluded names
type_name:
min_length: 3 # only warning
max_length: # warning and error
warning: 40
error: 50
excluded: iPhone # excluded via string
variable_name:
min_length: # only min_length
error: 2 # only error
excluded: # excluded via string array
- x
- y
- id
- URL
- GlobalAPIKey
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle)
70 changes: 43 additions & 27 deletions Demos/DemoLightbox/DemoLightbox.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
29B4A42F1C43A4320060ED52 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29B4A42E1C43A4320060ED52 /* ViewController.swift */; };
29B4A4341C43A4320060ED52 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 29B4A4331C43A4320060ED52 /* Assets.xcassets */; };
29B4A4371C43A4320060ED52 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 29B4A4351C43A4320060ED52 /* LaunchScreen.storyboard */; };
B7E424F67558A47CB29430AF /* Pods.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAE713340DA5D2F2EF13EA8D /* Pods.framework */; };
6103C426B512202012223B77 /* Pods_DemoLightbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B292A04CC5B492BBE47FD19B /* Pods_DemoLightbox.framework */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -21,30 +21,40 @@
29B4A4331C43A4320060ED52 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
29B4A4361C43A4320060ED52 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
29B4A4381C43A4320060ED52 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
862984732CE1769B7FCAD107 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
BF040811A09EF7ED090C748D /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
50DA7B1F749AA394FE5653E2 /* Pods-DemoLightbox.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DemoLightbox.release.xcconfig"; path = "Pods/Target Support Files/Pods-DemoLightbox/Pods-DemoLightbox.release.xcconfig"; sourceTree = "<group>"; };
B292A04CC5B492BBE47FD19B /* Pods_DemoLightbox.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DemoLightbox.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DAE713340DA5D2F2EF13EA8D /* Pods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods.framework; sourceTree = BUILT_PRODUCTS_DIR; };
F6C6211C49ECD8B15F32A93C /* Pods-DemoLightbox.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DemoLightbox.debug.xcconfig"; path = "Pods/Target Support Files/Pods-DemoLightbox/Pods-DemoLightbox.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
29B4A4261C43A4320060ED52 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B7E424F67558A47CB29430AF /* Pods.framework in Frameworks */,
6103C426B512202012223B77 /* Pods_DemoLightbox.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
153887050C38C94D185F4F31 /* Pods */ = {
isa = PBXGroup;
children = (
F6C6211C49ECD8B15F32A93C /* Pods-DemoLightbox.debug.xcconfig */,
50DA7B1F749AA394FE5653E2 /* Pods-DemoLightbox.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
29B4A4201C43A4320060ED52 = {
isa = PBXGroup;
children = (
29B4A42B1C43A4320060ED52 /* DemoLightbox */,
29B4A42A1C43A4320060ED52 /* Products */,
6D8CFCBA6E48A4A6439CE4EF /* Pods */,
B1B2B3DADEEC7FD14D4A9FF8 /* Frameworks */,
153887050C38C94D185F4F31 /* Pods */,
);
sourceTree = "<group>";
};
Expand All @@ -68,19 +78,11 @@
path = DemoLightbox;
sourceTree = "<group>";
};
6D8CFCBA6E48A4A6439CE4EF /* Pods */ = {
isa = PBXGroup;
children = (
862984732CE1769B7FCAD107 /* Pods.debug.xcconfig */,
BF040811A09EF7ED090C748D /* Pods.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
B1B2B3DADEEC7FD14D4A9FF8 /* Frameworks */ = {
isa = PBXGroup;
children = (
DAE713340DA5D2F2EF13EA8D /* Pods.framework */,
B292A04CC5B492BBE47FD19B /* Pods_DemoLightbox.framework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand All @@ -92,12 +94,13 @@
isa = PBXNativeTarget;
buildConfigurationList = 29B4A43B1C43A4320060ED52 /* Build configuration list for PBXNativeTarget "DemoLightbox" */;
buildPhases = (
06282289ACE0FE347CE75481 /* Check Pods Manifest.lock */,
186F9C312C32802BA8C876A5 /* 📦 Check Pods Manifest.lock */,
29B4A4251C43A4320060ED52 /* Sources */,
29B4A4261C43A4320060ED52 /* Frameworks */,
29B4A4271C43A4320060ED52 /* Resources */,
FE9DC4CBFB4CA271DE44FC3E /* Embed Pods Frameworks */,
D4C01A9FD0D35691D0B9D891 /* Copy Pods Resources */,
9366497046F222837C2712DC /* 📦 Embed Pods Frameworks */,
41CDA11DACE14BEC755CB66E /* 📦 Copy Pods Resources */,
BD36DBF51D0584D200BB7175 /* ShellScript */,
);
buildRules = (
);
Expand Down Expand Up @@ -154,51 +157,64 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
06282289ACE0FE347CE75481 /* Check Pods Manifest.lock */ = {
186F9C312C32802BA8C876A5 /* 📦 Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
name = "📦 Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
D4C01A9FD0D35691D0B9D891 /* Copy Pods Resources */ = {
41CDA11DACE14BEC755CB66E /* 📦 Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
name = "📦 Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n";
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DemoLightbox/Pods-DemoLightbox-resources.sh\"\n";
showEnvVarsInLog = 0;
};
FE9DC4CBFB4CA271DE44FC3E /* Embed Pods Frameworks */ = {
9366497046F222837C2712DC /* 📦 Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
name = "📦 Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-frameworks.sh\"\n";
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DemoLightbox/Pods-DemoLightbox-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
BD36DBF51D0584D200BB7175 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftlint >/dev/null; then\nswiftlint\nelse\necho \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down Expand Up @@ -308,7 +324,7 @@
};
29B4A43C1C43A4320060ED52 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 862984732CE1769B7FCAD107 /* Pods.debug.xcconfig */;
baseConfigurationReference = F6C6211C49ECD8B15F32A93C /* Pods-DemoLightbox.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = DemoLightbox/Info.plist;
Expand All @@ -320,7 +336,7 @@
};
29B4A43D1C43A4320060ED52 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = BF040811A09EF7ED090C748D /* Pods.release.xcconfig */;
baseConfigurationReference = 50DA7B1F749AA394FE5653E2 /* Pods-DemoLightbox.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = DemoLightbox/Info.plist;
Expand Down
2 changes: 2 additions & 0 deletions Demos/DemoLightbox/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ platform :ios, '8.0'
use_frameworks!
inhibit_all_warnings!

target "DemoLightbox" do
pod 'Lightbox', path: '../../'
pod 'Sugar'
pod 'Hue', git: 'https://github.com/hyperoslo/Hue'
end
16 changes: 9 additions & 7 deletions Demos/DemoLightbox/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
PODS:
- Hue (1.0.0)
- Hue (1.1)
- Lightbox (1.0.0):
- Hue
- Sugar
- Sugar (1.0.4)
- Sugar (1.1.1)

DEPENDENCIES:
- Hue (from `https://github.com/hyperoslo/Hue`)
Expand All @@ -14,16 +14,18 @@ EXTERNAL SOURCES:
Hue:
:git: https://github.com/hyperoslo/Hue
Lightbox:
:path: ../../
:path: "../../"

CHECKOUT OPTIONS:
Hue:
:commit: 4f0f8bfdb69d926883216ffe9a802a5a2022f3f5
:commit: 43404964a799dd0c8affc2d4631ead33df8e04f1
:git: https://github.com/hyperoslo/Hue

SPEC CHECKSUMS:
Hue: 44ae8b1091935fcc75055174095ab04653989235
Hue: c7d6a7206bac669ed69e78cc6c14a4d7bd28277c
Lightbox: 857975225b89e83758b4895c035f5621d62e9bba
Sugar: 814a9f59f546b942884a276f32324e73d6f93b11
Sugar: bed396c924fd089feee7c780778cca2a124f580c

COCOAPODS: 0.39.0
PODFILE CHECKSUM: 454f6a62854b449796f88a5b1a0617ceb8f8de52

COCOAPODS: 1.0.0
8 changes: 5 additions & 3 deletions Source/Library/LightboxTransition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class LightboxTransition: UIPercentDrivenInteractiveTransition {
}
}

var lightboxController: LightboxController?
weak var lightboxController: LightboxController?

// MARK: - Transition

Expand Down Expand Up @@ -79,7 +79,7 @@ class LightboxTransition: UIPercentDrivenInteractiveTransition {
self.scrollView?.frame.origin.y = translation.y * 3
controller.view.alpha = 0
controller.view.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0)
}, completion: { _ in })
}, completion: { _ in })
} else {
cancelInteractiveTransition()

Expand Down Expand Up @@ -144,7 +144,9 @@ extension LightboxTransition: UIViewControllerTransitioningDelegate {
return self
}

func animationControllerForPresentedController(presented: UIViewController, presentingController presenting: UIViewController, sourceController source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
func animationControllerForPresentedController(presented: UIViewController,
presentingController presenting: UIViewController,
sourceController source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
dismissing = false
return self
}
Expand Down
6 changes: 3 additions & 3 deletions Source/LightboxController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class LightboxController: UIViewController {
}()

public private(set) lazy var overlayView: UIView = { [unowned self] in
let view = UIView(frame: CGRectZero)
let view = UIView(frame: CGRect.zero)
let gradient = CAGradientLayer()
let colors = [UIColor.hex("090909").alpha(0), UIColor.hex("040404")]

Expand Down Expand Up @@ -361,7 +361,7 @@ extension LightboxController: HeaderViewDelegate {
}

let prevIndex = currentPage

if currentPage == numberOfPages - 1 {
previous()
} else {
Expand Down Expand Up @@ -392,7 +392,7 @@ extension LightboxController: FooterViewDelegate {

public func footerView(footerView: FooterView, didExpand expanded: Bool) {
footerView.frame.origin.y = screenBounds.height - footerView.frame.height

UIView.animateWithDuration(0.25) {
self.overlayView.alpha = expanded ? 1.0 : 0.0
self.headerView.deleteButton.alpha = expanded ? 0.0 : 1.0
Expand Down
Loading

0 comments on commit 8794987

Please sign in to comment.