Skip to content

SPM Integration #97

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion DGElasticPullToRefresh.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Pod::Spec.new do |spec|
:tag => '1.1' }
spec.license = { :type => "MIT", :file => "LICENSE" }
spec.platform = :ios, '8.0'
spec.source_files = "DGElasticPullToRefresh/*.swift"
spec.source_files = "Sources/DGElasticPullToRefresh/*.swift"

spec.requires_arc = true

Expand Down
92 changes: 59 additions & 33 deletions DGElasticPullToRefreshExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@
objects = {

/* Begin PBXBuildFile section */
05B92F8C1BD25E7B006D60FB /* DGElasticPullToRefreshConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05B92F871BD25E7B006D60FB /* DGElasticPullToRefreshConstants.swift */; };
05B92F8D1BD25E7B006D60FB /* DGElasticPullToRefreshExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05B92F881BD25E7B006D60FB /* DGElasticPullToRefreshExtensions.swift */; };
05B92F8E1BD25E7B006D60FB /* DGElasticPullToRefreshLoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05B92F891BD25E7B006D60FB /* DGElasticPullToRefreshLoadingView.swift */; };
05B92F8F1BD25E7B006D60FB /* DGElasticPullToRefreshLoadingViewCircle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05B92F8A1BD25E7B006D60FB /* DGElasticPullToRefreshLoadingViewCircle.swift */; };
05B92F901BD25E7B006D60FB /* DGElasticPullToRefreshView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05B92F8B1BD25E7B006D60FB /* DGElasticPullToRefreshView.swift */; };
05CD14691BBE8FEA00AF4030 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05CD14681BBE8FEA00AF4030 /* AppDelegate.swift */; };
05CD146B1BBE8FEA00AF4030 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05CD146A1BBE8FEA00AF4030 /* ViewController.swift */; };
05CD14701BBE8FEA00AF4030 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 05CD146F1BBE8FEA00AF4030 /* Assets.xcassets */; };
05CD14731BBE8FEA00AF4030 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 05CD14711BBE8FEA00AF4030 /* LaunchScreen.storyboard */; };
05FAB8BE1BBEF115004922F1 /* NavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05FAB8BD1BBEF115004922F1 /* NavigationController.swift */; };
CF3B5FF525588D9F00B1D7F6 /* DGElasticPullToRefreshLoadingViewCircle.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF3B5FF025588D9F00B1D7F6 /* DGElasticPullToRefreshLoadingViewCircle.swift */; };
CF3B5FF625588D9F00B1D7F6 /* DGElasticPullToRefreshView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF3B5FF125588D9F00B1D7F6 /* DGElasticPullToRefreshView.swift */; };
CF3B5FF725588D9F00B1D7F6 /* DGElasticPullToRefreshConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF3B5FF225588D9F00B1D7F6 /* DGElasticPullToRefreshConstants.swift */; };
CF3B5FF825588D9F00B1D7F6 /* DGElasticPullToRefreshExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF3B5FF325588D9F00B1D7F6 /* DGElasticPullToRefreshExtensions.swift */; };
CF3B5FF925588D9F00B1D7F6 /* DGElasticPullToRefreshLoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF3B5FF425588D9F00B1D7F6 /* DGElasticPullToRefreshLoadingView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
05B92F871BD25E7B006D60FB /* DGElasticPullToRefreshConstants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DGElasticPullToRefreshConstants.swift; sourceTree = "<group>"; };
05B92F881BD25E7B006D60FB /* DGElasticPullToRefreshExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DGElasticPullToRefreshExtensions.swift; sourceTree = "<group>"; };
05B92F891BD25E7B006D60FB /* DGElasticPullToRefreshLoadingView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DGElasticPullToRefreshLoadingView.swift; sourceTree = "<group>"; };
05B92F8A1BD25E7B006D60FB /* DGElasticPullToRefreshLoadingViewCircle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DGElasticPullToRefreshLoadingViewCircle.swift; sourceTree = "<group>"; };
05B92F8B1BD25E7B006D60FB /* DGElasticPullToRefreshView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DGElasticPullToRefreshView.swift; sourceTree = "<group>"; };
05CD14651BBE8FEA00AF4030 /* DGElasticPullToRefreshExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DGElasticPullToRefreshExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
05CD14681BBE8FEA00AF4030 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
05CD146A1BBE8FEA00AF4030 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
05CD146F1BBE8FEA00AF4030 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
05CD14721BBE8FEA00AF4030 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
05CD14741BBE8FEA00AF4030 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
05FAB8BD1BBEF115004922F1 /* NavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationController.swift; sourceTree = "<group>"; };
CF3B5FF025588D9F00B1D7F6 /* DGElasticPullToRefreshLoadingViewCircle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DGElasticPullToRefreshLoadingViewCircle.swift; sourceTree = "<group>"; };
CF3B5FF125588D9F00B1D7F6 /* DGElasticPullToRefreshView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DGElasticPullToRefreshView.swift; sourceTree = "<group>"; };
CF3B5FF225588D9F00B1D7F6 /* DGElasticPullToRefreshConstants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DGElasticPullToRefreshConstants.swift; sourceTree = "<group>"; };
CF3B5FF325588D9F00B1D7F6 /* DGElasticPullToRefreshExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DGElasticPullToRefreshExtensions.swift; sourceTree = "<group>"; };
CF3B5FF425588D9F00B1D7F6 /* DGElasticPullToRefreshLoadingView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DGElasticPullToRefreshLoadingView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -45,18 +45,6 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
05B92F861BD25E7B006D60FB /* DGElasticPullToRefresh */ = {
isa = PBXGroup;
children = (
05B92F871BD25E7B006D60FB /* DGElasticPullToRefreshConstants.swift */,
05B92F881BD25E7B006D60FB /* DGElasticPullToRefreshExtensions.swift */,
05B92F891BD25E7B006D60FB /* DGElasticPullToRefreshLoadingView.swift */,
05B92F8A1BD25E7B006D60FB /* DGElasticPullToRefreshLoadingViewCircle.swift */,
05B92F8B1BD25E7B006D60FB /* DGElasticPullToRefreshView.swift */,
);
path = DGElasticPullToRefresh;
sourceTree = SOURCE_ROOT;
};
05CD145C1BBE8FEA00AF4030 = {
isa = PBXGroup;
children = (
Expand All @@ -76,7 +64,7 @@
05CD14671BBE8FEA00AF4030 /* DGElasticPullToRefreshExample */ = {
isa = PBXGroup;
children = (
05B92F861BD25E7B006D60FB /* DGElasticPullToRefresh */,
CF3B5FEF25588D9F00B1D7F6 /* DGElasticPullToRefresh */,
05CD14681BBE8FEA00AF4030 /* AppDelegate.swift */,
05CD146A1BBE8FEA00AF4030 /* ViewController.swift */,
05FAB8BD1BBEF115004922F1 /* NavigationController.swift */,
Expand All @@ -87,6 +75,19 @@
path = DGElasticPullToRefreshExample;
sourceTree = "<group>";
};
CF3B5FEF25588D9F00B1D7F6 /* DGElasticPullToRefresh */ = {
isa = PBXGroup;
children = (
CF3B5FF025588D9F00B1D7F6 /* DGElasticPullToRefreshLoadingViewCircle.swift */,
CF3B5FF125588D9F00B1D7F6 /* DGElasticPullToRefreshView.swift */,
CF3B5FF225588D9F00B1D7F6 /* DGElasticPullToRefreshConstants.swift */,
CF3B5FF325588D9F00B1D7F6 /* DGElasticPullToRefreshExtensions.swift */,
CF3B5FF425588D9F00B1D7F6 /* DGElasticPullToRefreshLoadingView.swift */,
);
name = DGElasticPullToRefresh;
path = Sources/DGElasticPullToRefresh;
sourceTree = SOURCE_ROOT;
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand All @@ -113,18 +114,18 @@
05CD145D1BBE8FEA00AF4030 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0700;
LastUpgradeCheck = 1130;
ORGANIZATIONNAME = "Danil Gontovnik";
TargetAttributes = {
05CD14641BBE8FEA00AF4030 = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 0800;
LastSwiftMigration = 1130;
};
};
};
buildConfigurationList = 05CD14601BBE8FEA00AF4030 /* Build configuration list for PBXProject "DGElasticPullToRefreshExample" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -157,14 +158,14 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
05B92F8C1BD25E7B006D60FB /* DGElasticPullToRefreshConstants.swift in Sources */,
CF3B5FF825588D9F00B1D7F6 /* DGElasticPullToRefreshExtensions.swift in Sources */,
CF3B5FF625588D9F00B1D7F6 /* DGElasticPullToRefreshView.swift in Sources */,
CF3B5FF925588D9F00B1D7F6 /* DGElasticPullToRefreshLoadingView.swift in Sources */,
05CD146B1BBE8FEA00AF4030 /* ViewController.swift in Sources */,
05B92F901BD25E7B006D60FB /* DGElasticPullToRefreshView.swift in Sources */,
05B92F8E1BD25E7B006D60FB /* DGElasticPullToRefreshLoadingView.swift in Sources */,
CF3B5FF725588D9F00B1D7F6 /* DGElasticPullToRefreshConstants.swift in Sources */,
05FAB8BE1BBEF115004922F1 /* NavigationController.swift in Sources */,
05B92F8F1BD25E7B006D60FB /* DGElasticPullToRefreshLoadingViewCircle.swift in Sources */,
CF3B5FF525588D9F00B1D7F6 /* DGElasticPullToRefreshLoadingViewCircle.swift in Sources */,
05CD14691BBE8FEA00AF4030 /* AppDelegate.swift in Sources */,
05B92F8D1BD25E7B006D60FB /* DGElasticPullToRefreshExtensions.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -186,17 +187,28 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
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_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
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_IMPLICIT_RETAIN_SELF = 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;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand Down Expand Up @@ -231,17 +243,28 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
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_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
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_IMPLICIT_RETAIN_SELF = 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;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand All @@ -260,6 +283,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
Expand All @@ -274,7 +298,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.gatafan.DGElasticPullToRefreshExample;
PRODUCT_NAME = DGElasticPullToRefreshExample;
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -287,7 +312,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.gatafan.DGElasticPullToRefreshExample;
PRODUCT_NAME = DGElasticPullToRefreshExample;
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
Expand Down Expand Up @@ -30,6 +40,16 @@
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
Expand Down Expand Up @@ -59,6 +79,16 @@
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
Expand Down
17 changes: 17 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "DGElasticPullToRefresh",
products: [
.library(
name: "DGElasticPullToRefresh",
targets: ["DGElasticPullToRefresh"]),
],
targets: [
.target(
name: "DGElasticPullToRefresh"),
]
)
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@ public extension NSObject {
// MARK: -
// MARK: Methods

public func dg_addObserver(_ observer: NSObject, forKeyPath keyPath: String) {
func dg_addObserver(_ observer: NSObject, forKeyPath keyPath: String) {
let observerInfo = [keyPath : observer]

if dg_observers.index(where: { $0 == observerInfo }) == nil {
if dg_observers.firstIndex(where: { $0 == observerInfo }) == nil {
dg_observers.append(observerInfo)
addObserver(observer, forKeyPath: keyPath, options: .new, context: nil)
}
}

public func dg_removeObserver(_ observer: NSObject, forKeyPath keyPath: String) {
func dg_removeObserver(_ observer: NSObject, forKeyPath keyPath: String) {
let observerInfo = [keyPath : observer]

if let index = dg_observers.index(where: { $0 == observerInfo}) {
if let index = dg_observers.firstIndex(where: { $0 == observerInfo}) {
dg_observers.remove(at: index)
removeObserver(observer, forKeyPath: keyPath)
}
Expand Down Expand Up @@ -99,7 +99,7 @@ public extension UIScrollView {

// MARK: - Methods (Public)

public func dg_addPullToRefreshWithActionHandler(_ actionHandler: @escaping () -> Void, loadingView: DGElasticPullToRefreshLoadingView?) {
func dg_addPullToRefreshWithActionHandler(_ actionHandler: @escaping () -> Void, loadingView: DGElasticPullToRefreshLoadingView?) {
isMultipleTouchEnabled = false
panGestureRecognizer.maximumNumberOfTouches = 1

Expand All @@ -112,21 +112,21 @@ public extension UIScrollView {
pullToRefreshView.observing = true
}

public func dg_removePullToRefresh() {
func dg_removePullToRefresh() {
pullToRefreshView?.disassociateDisplayLink()
pullToRefreshView?.observing = false
pullToRefreshView?.removeFromSuperview()
}

public func dg_setPullToRefreshBackgroundColor(_ color: UIColor) {
func dg_setPullToRefreshBackgroundColor(_ color: UIColor) {
pullToRefreshView?.backgroundColor = color
}

public func dg_setPullToRefreshFillColor(_ color: UIColor) {
func dg_setPullToRefreshFillColor(_ color: UIColor) {
pullToRefreshView?.fillColor = color
}

public func dg_stopLoading() {
func dg_stopLoading() {
pullToRefreshView?.stopLoading()
}
}
Expand Down Expand Up @@ -157,8 +157,8 @@ public extension UIPanGestureRecognizer {
// MARK: -
// MARK: (UIGestureRecognizerState) Extension

public extension UIGestureRecognizerState {
func dg_isAnyOf(_ values: [UIGestureRecognizerState]) -> Bool {
public extension UIGestureRecognizer.State {
func dg_isAnyOf(_ values: [UIGestureRecognizer.State]) -> Bool {
return values.contains(where: { $0 == self })
}
}
Loading