Skip to content

Commit

Permalink
Merge pull request #5 from bfernandesbfs/spm
Browse files Browse the repository at this point in the history
Spm
  • Loading branch information
foxacid7cd committed Nov 16, 2019
2 parents 9c56905 + 3162dd1 commit 9e572f1
Show file tree
Hide file tree
Showing 24 changed files with 127 additions and 46 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -28,6 +28,7 @@ xcuserdata

# Swift Package Manager
.build/
.swiftpm/

# Carthage
Carthage/Build
4 changes: 2 additions & 2 deletions AirBar.podspec
@@ -1,12 +1,12 @@
Pod::Spec.new do |spec|
spec.name = "AirBar"
spec.version = "2.0.5"
spec.version = "2.0.6"
spec.summary = "Airbnb expandable bar."
spec.homepage = "https://github.com/uptechteam/AirBar"
spec.license = { type: 'MIT', file: 'LICENSE' }
spec.authors = { "Evgeny Matviyenko" => 'evgeny.matviyenko@uptech.team' }

spec.platform = :ios, "9.1"
spec.platform = :ios, "10.0"
spec.swift_version = "4.1"
spec.requires_arc = true
spec.source = { git: "https://github.com/uptechteam/AirBar.git", tag: "v#{spec.version}", submodules: true }
Expand Down
36 changes: 28 additions & 8 deletions AirBar.xcodeproj/project.pbxproj
Expand Up @@ -404,7 +404,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0820;
LastUpgradeCheck = 0820;
LastUpgradeCheck = 1110;
ORGANIZATIONNAME = uptechteam;
TargetAttributes = {
6A243AC31E6028D500AC0D40 = {
Expand All @@ -427,7 +427,7 @@
};
buildConfigurationList = 6A243ABE1E6028D500AC0D40 /* Build configuration list for PBXProject "AirBar" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -568,20 +568,29 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = 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_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_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;
Expand Down Expand Up @@ -611,6 +620,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -621,20 +631,29 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = 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_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_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;
Expand All @@ -656,6 +675,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -682,7 +702,7 @@
SKIP_INSTALL = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -704,7 +724,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -717,7 +737,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.uptech.AirBarTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -730,7 +750,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.uptech.AirBarTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -746,7 +766,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.uptech.AirBarExampleApp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -762,7 +782,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.uptech.AirBarExampleApp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
27 changes: 11 additions & 16 deletions AirBar.xcodeproj/xcshareddata/xcschemes/AirBar.xcscheme
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
version = "1.8">
LastUpgradeVersion = "1110"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
Expand All @@ -26,9 +26,17 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6A243AC31E6028D500AC0D40"
BuildableName = "AirBar.framework"
BlueprintName = "AirBar"
ReferencedContainer = "container:AirBar.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -41,17 +49,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6A243AC31E6028D500AC0D40"
BuildableName = "AirBar.framework"
BlueprintName = "AirBar"
ReferencedContainer = "container:AirBar.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -72,8 +69,6 @@
ReferencedContainer = "container:AirBar.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
4 changes: 2 additions & 2 deletions AirBar/BarController.swift
Expand Up @@ -13,7 +13,7 @@ public typealias StateObserver = (State) -> Void
private struct ScrollableObservables {
let contentOffset: Observable<CGPoint>
let contentSize: Observable<CGSize>
let panGestureState: Observable<UIGestureRecognizerState>
let panGestureState: Observable<UIGestureRecognizer.State>
}

public class BarController {
Expand Down Expand Up @@ -164,7 +164,7 @@ public class BarController {
}

// MARK: Pan Gesture Handlers
private func panGestureStateChanged(state: UIGestureRecognizerState) {
private func panGestureStateChanged(state: UIGestureRecognizer.State) {
switch state {
case .began:
panGestureBegan()
Expand Down
8 changes: 5 additions & 3 deletions AirBar/Helpers/CGFloat+AirBar.swift
Expand Up @@ -6,12 +6,14 @@
// Copyright © 2017 uptechteam. All rights reserved.
//

import UIKit

internal extension CGFloat {
internal func isNear(to number: CGFloat, delta: CGFloat) -> Bool {
func isNear(to number: CGFloat, delta: CGFloat) -> Bool {
return self >= (number - delta) && self <= (number + delta)
}

internal func map(from firstBounds: (CGFloat, CGFloat), to secondBounds: (CGFloat, CGFloat)) -> CGFloat {
func map(from firstBounds: (CGFloat, CGFloat), to secondBounds: (CGFloat, CGFloat)) -> CGFloat {
guard self > firstBounds.0 else {
return secondBounds.0
}
Expand All @@ -25,7 +27,7 @@ internal extension CGFloat {
return secondBounds.0 + ratio * (secondBounds.1 - secondBounds.0)
}

internal func bounded(by bounds: (CGFloat, CGFloat)) -> CGFloat {
func bounded(by bounds: (CGFloat, CGFloat)) -> CGFloat {
return Swift.max(bounds.0, Swift.min(bounds.1, self))
}
}
2 changes: 2 additions & 0 deletions AirBar/Models/Configuration.swift
Expand Up @@ -6,6 +6,8 @@
// Copyright © 2017 uptechteam. All rights reserved.
//

import UIKit

public struct Configuration {
let compactStateHeight: CGFloat
let normalStateHeight: CGFloat
Expand Down
10 changes: 6 additions & 4 deletions AirBar/Models/State.swift
Expand Up @@ -6,6 +6,8 @@
// Copyright © 2017 uptechteam. All rights reserved.
//

import UIKit

public struct State {
internal let offset: CGFloat
internal let isExpandedStateAvailable: Bool
Expand Down Expand Up @@ -47,19 +49,19 @@ public struct State {
}

public extension State {
public func height() -> CGFloat {
func height() -> CGFloat {
return -offset
}

public func transitionProgress() -> CGFloat {
func transitionProgress() -> CGFloat {
let stateRange = self.stateRange()
let offsetBounds = configuration.offsetBounds(for: stateRange)
let progressBounds = stateRange.progressBounds()
let reversedProgressBounds = (progressBounds.1, progressBounds.0)
return offset.map(from: offsetBounds, to: reversedProgressBounds)
}

public enum ValueRangeType {
enum ValueRangeType {
case value(CGFloat)
case range(CGFloat, CGFloat)

Expand All @@ -73,7 +75,7 @@ public extension State {
}
}

public func value(compactNormalRange: ValueRangeType, normalExpandedRange: ValueRangeType) -> CGFloat {
func value(compactNormalRange: ValueRangeType, normalExpandedRange: ValueRangeType) -> CGFloat {
let progress = self.transitionProgress()
let stateRange = self.stateRange()
let valueRange = stateRange == .compactNormal ? compactNormalRange : normalExpandedRange
Expand Down
2 changes: 2 additions & 0 deletions AirBar/Models/StateRange.swift
Expand Up @@ -6,6 +6,8 @@
// Copyright © 2017 uptechteam. All rights reserved.
//

import UIKit

internal enum StateRange {
case compactNormal
case normalExpanded
Expand Down
4 changes: 3 additions & 1 deletion AirBar/Observables/GestureStateObservable.swift
Expand Up @@ -6,7 +6,9 @@
// Copyright © 2017 uptechteam. All rights reserved.
//

internal class GestureStateObservable: Observable<UIGestureRecognizerState> {
import UIKit

internal class GestureStateObservable: Observable<UIGestureRecognizer.State> {
private weak var gestureRecognizer: UIGestureRecognizer?

internal init(gestureRecognizer: UIGestureRecognizer) {
Expand Down
2 changes: 2 additions & 0 deletions AirBar/Observables/KVObservable.swift
Expand Up @@ -6,6 +6,8 @@
// Copyright © 2017 uptechteam. All rights reserved.
//

import Foundation

internal class KVObservable<Value>: Observable<Value> {
private let keyPath: String
private weak var object: AnyObject?
Expand Down
2 changes: 2 additions & 0 deletions AirBar/Observables/Observable.swift
Expand Up @@ -6,6 +6,8 @@
// Copyright © 2017 uptechteam. All rights reserved.
//

import Foundation

internal class Observable<Value>: NSObject {
internal var observer: ((Value) -> Void)?
}
2 changes: 2 additions & 0 deletions AirBar/Reducer/CutOutStateRangeDeltaYTransformer.swift
Expand Up @@ -6,6 +6,8 @@
// Copyright © 2017 uptechteam. All rights reserved.
//

import UIKit

internal let cutOutStateRangeDeltaYTransformer: ContentOffsetDeltaYTransformer = { params -> CGFloat in
var deltaY = params.contentOffsetDeltaY

Expand Down
2 changes: 2 additions & 0 deletions AirBar/Reducer/IgnoreBottomDeltaYTransformer.swift
Expand Up @@ -6,6 +6,8 @@
// Copyright © 2017 uptechteam. All rights reserved.
//

import UIKit

internal let ignoreBottomDeltaYTransformer: ContentOffsetDeltaYTransformer = { params -> CGFloat in
var deltaY = params.contentOffsetDeltaY

Expand Down
2 changes: 2 additions & 0 deletions AirBar/Reducer/IgnoreTopDeltaYTransformer.swift
Expand Up @@ -6,6 +6,8 @@
// Copyright © 2017 uptechteam. All rights reserved.
//

import UIKit

internal let ignoreTopDeltaYTransformer: ContentOffsetDeltaYTransformer = { params -> CGFloat in
var deltaY = params.contentOffsetDeltaY

Expand Down

0 comments on commit 9e572f1

Please sign in to comment.