Skip to content

Commit

Permalink
fix possible memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
hongxinhope committed Jun 22, 2016
1 parent 7c20a2d commit 5ada648
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions SegmentedControl/SegmentedControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

import UIKit

public protocol SegmentedControlDelegate {
public protocol SegmentedControlDelegate: class {
func segmentedControl(segmentedControl: SegmentedControl, didSelectIndex selectedIndex: Int)
func segmentedControl(segmentedControl: SegmentedControl, didLongPressIndex longPressIndex: Int)
}

public class SegmentedControl: UIControl {
public var delegate: SegmentedControlDelegate?
public weak var delegate: SegmentedControlDelegate?
public private(set) var selectedIndex = 0 {
didSet {
setNeedsDisplay()
Expand Down Expand Up @@ -49,7 +49,7 @@ public class SegmentedControl: UIControl {
didSet {
if longPressEnabled {
longPressGesture = UILongPressGestureRecognizer()
longPressGesture!.addTarget(self, action: "segmentedControlLongPressed:")
longPressGesture!.addTarget(self, action: #selector(segmentedControlLongPressed(_:)))
longPressGesture!.minimumPressDuration = longPressMinimumPressDuration
scrollView.addGestureRecognizer(longPressGesture!)
longPressGesture!.delegate = self
Expand Down
2 changes: 1 addition & 1 deletion SegmentedControl/Supporting Files/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>0.0.3</string>
<string>0.0.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
16 changes: 8 additions & 8 deletions SegmentedControlExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,44 @@
objects = {

/* Begin PBXBuildFile section */
D341EB501D1A838400677EAF /* SegmentedControl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D341EB4F1D1A838400677EAF /* SegmentedControl.framework */; };
D341EB511D1A838400677EAF /* SegmentedControl.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D341EB4F1D1A838400677EAF /* SegmentedControl.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
D3E3B0E31C328316003EAA6E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3E3B0E21C328316003EAA6E /* AppDelegate.swift */; };
D3E3B0E51C328316003EAA6E /* ExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3E3B0E41C328316003EAA6E /* ExampleViewController.swift */; };
D3E3B0E81C328316003EAA6E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D3E3B0E61C328316003EAA6E /* Main.storyboard */; };
D3E3B0EA1C328316003EAA6E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D3E3B0E91C328316003EAA6E /* Assets.xcassets */; };
D3E3B1071C3286B0003EAA6E /* SegmentedControl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3E3B1061C3286B0003EAA6E /* SegmentedControl.framework */; };
D3E3B1081C3286B0003EAA6E /* SegmentedControl.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D3E3B1061C3286B0003EAA6E /* SegmentedControl.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
D3E3B1091C3286B0003EAA6E /* Embed Frameworks */ = {
D341EB521D1A838400677EAF /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
D3E3B1081C3286B0003EAA6E /* SegmentedControl.framework in Embed Frameworks */,
D341EB511D1A838400677EAF /* SegmentedControl.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
D341EB4F1D1A838400677EAF /* SegmentedControl.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = SegmentedControl.framework; path = "/Users/hongxin/Library/Developer/Xcode/DerivedData/SegmentedControl-fegllupftdbokageotnuxdmypufc/Build/Products/Debug-iphonesimulator/SegmentedControl.framework"; sourceTree = "<absolute>"; };
D3E3B0DF1C328316003EAA6E /* SegmentedControlExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SegmentedControlExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
D3E3B0E21C328316003EAA6E /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
D3E3B0E41C328316003EAA6E /* ExampleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleViewController.swift; sourceTree = "<group>"; };
D3E3B0E71C328316003EAA6E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
D3E3B0E91C328316003EAA6E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
D3E3B0EE1C328316003EAA6E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D3E3B1061C3286B0003EAA6E /* SegmentedControl.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = SegmentedControl.framework; path = "/Users/hongxin/Library/Developer/Xcode/DerivedData/SegmentedControl-fegllupftdbokageotnuxdmypufc/Build/Products/Debug-iphoneos/SegmentedControl.framework"; sourceTree = "<absolute>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
D3E3B0DC1C328316003EAA6E /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
D3E3B1071C3286B0003EAA6E /* SegmentedControl.framework in Frameworks */,
D341EB501D1A838400677EAF /* SegmentedControl.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -54,7 +54,7 @@
D3E3B0D61C328316003EAA6E = {
isa = PBXGroup;
children = (
D3E3B1061C3286B0003EAA6E /* SegmentedControl.framework */,
D341EB4F1D1A838400677EAF /* SegmentedControl.framework */,
D3E3B0E11C328316003EAA6E /* SegmentedControlExample */,
D3E3B0E01C328316003EAA6E /* Products */,
);
Expand Down Expand Up @@ -90,7 +90,7 @@
D3E3B0DB1C328316003EAA6E /* Sources */,
D3E3B0DC1C328316003EAA6E /* Frameworks */,
D3E3B0DD1C328316003EAA6E /* Resources */,
D3E3B1091C3286B0003EAA6E /* Embed Frameworks */,
D341EB521D1A838400677EAF /* Embed Frameworks */,
);
buildRules = (
);
Expand Down
4 changes: 2 additions & 2 deletions SegmentedControlExample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.0.3</string>
<string>0.0.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>3</string>
<string>4</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
Expand Down

0 comments on commit 5ada648

Please sign in to comment.