Skip to content
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
23 changes: 14 additions & 9 deletions ParallaxHeader.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = MagicLab;
TargetAttributes = {
B5CCB78C1EFD0E5400194CFB = {
Expand Down Expand Up @@ -462,6 +462,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -673,13 +674,15 @@
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;
Expand Down Expand Up @@ -733,13 +736,15 @@
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;
Expand Down Expand Up @@ -791,7 +796,7 @@
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -814,7 +819,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -828,7 +833,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.magiclab.ParallaxHeaderTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -841,7 +846,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.magiclab.ParallaxHeaderTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand All @@ -858,7 +863,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.magiclab.Exmple;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -875,7 +880,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.magiclab.Exmple;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand All @@ -890,7 +895,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.magiclab.ExmpleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Exmple.app/Exmple";
};
name = Debug;
Expand All @@ -906,7 +911,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.magiclab.ExmpleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Exmple.app/Exmple";
};
name = Release;
Expand Down
54 changes: 27 additions & 27 deletions ParallaxHeader/ParallaxHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public typealias ParallaxHeaderHandlerBlock = (_ parallaxHeader: ParallaxHeader)


private let parallaxHeaderKVOContext = UnsafeMutableRawPointer.allocate(
bytes: 4,
alignedTo: 1
byteCount: 4,
alignment: 1
)

class ParallaxView: UIView {
Expand Down Expand Up @@ -225,15 +225,15 @@ public class ParallaxHeader: NSObject {
contentView.addConstraints(
NSLayoutConstraint.constraints(
withVisualFormat: "H:|[v]|",
options: NSLayoutFormatOptions(rawValue: 0),
options: NSLayoutConstraint.FormatOptions(rawValue: 0),
metrics: nil,
views: binding
)
)
contentView.addConstraints(
NSLayoutConstraint.constraints(
withVisualFormat: "V:|[v]|",
options: NSLayoutFormatOptions(rawValue: 0),
options: NSLayoutConstraint.FormatOptions(rawValue: 0),
metrics: nil,
views: binding
)
Expand All @@ -250,15 +250,15 @@ public class ParallaxHeader: NSObject {
contentView.addConstraints(
NSLayoutConstraint.constraints(
withVisualFormat: "H:|[v]|",
options: NSLayoutFormatOptions(rawValue: 0),
options: NSLayoutConstraint.FormatOptions(rawValue: 0),
metrics: nil,
views: binding
)
)
contentView.addConstraints(
NSLayoutConstraint.constraints(
withVisualFormat: "V:|[v(==height)]",
options: NSLayoutFormatOptions(rawValue: 0),
options: NSLayoutConstraint.FormatOptions(rawValue: 0),
metrics: metrics,
views: binding
)
Expand All @@ -276,15 +276,15 @@ public class ParallaxHeader: NSObject {
contentView.addConstraints(
NSLayoutConstraint.constraints(
withVisualFormat: "H:|[v]|",
options: NSLayoutFormatOptions(rawValue: 0),
options: NSLayoutConstraint.FormatOptions(rawValue: 0),
metrics: nil,
views: binding
)
)
contentView.addConstraints(
NSLayoutConstraint.constraints(
withVisualFormat: "V:|[v(>=height)]-0.0@highPriority-|",
options: NSLayoutFormatOptions(rawValue: 0),
options: NSLayoutConstraint.FormatOptions(rawValue: 0),
metrics: metrics,
views: binding
)
Expand All @@ -298,7 +298,7 @@ public class ParallaxHeader: NSObject {
contentView.addConstraints(
NSLayoutConstraint.constraints(
withVisualFormat: "H:|[v]|",
options: NSLayoutFormatOptions(rawValue: 0),
options: NSLayoutConstraint.FormatOptions(rawValue: 0),
metrics: nil,
views: binding
)
Expand All @@ -307,21 +307,21 @@ public class ParallaxHeader: NSObject {
contentView.addConstraint(
NSLayoutConstraint(
item: view,
attribute: NSLayoutAttribute.centerY,
relatedBy: NSLayoutRelation.equal,
attribute: NSLayoutConstraint.Attribute.centerY,
relatedBy: NSLayoutConstraint.Relation.equal,
toItem: contentView,
attribute: NSLayoutAttribute.centerY,
attribute: NSLayoutConstraint.Attribute.centerY,
multiplier: 1,
constant: 0
)
)
contentView.addConstraint(
NSLayoutConstraint(
item: view,
attribute: NSLayoutAttribute.centerX,
relatedBy: NSLayoutRelation.equal,
attribute: NSLayoutConstraint.Attribute.centerX,
relatedBy: NSLayoutConstraint.Relation.equal,
toItem: contentView,
attribute: NSLayoutAttribute.centerX,
attribute: NSLayoutConstraint.Attribute.centerX,
multiplier: 1,
constant: 0
)
Expand All @@ -339,15 +339,15 @@ public class ParallaxHeader: NSObject {
contentView.addConstraints(
NSLayoutConstraint.constraints(
withVisualFormat: "H:|[v]|",
options: NSLayoutFormatOptions(rawValue: 0),
options: NSLayoutConstraint.FormatOptions(rawValue: 0),
metrics: nil,
views: binding
)
)
contentView.addConstraints(
NSLayoutConstraint.constraints(
withVisualFormat: "V:|-0@highPriority-[v(>=height)]-0@highPriority-|",
options: NSLayoutFormatOptions(rawValue: 0),
options: NSLayoutConstraint.FormatOptions(rawValue: 0),
metrics: metrics,
views: binding
)
Expand All @@ -356,21 +356,21 @@ public class ParallaxHeader: NSObject {
contentView.addConstraint(
NSLayoutConstraint(
item: view,
attribute: NSLayoutAttribute.centerY,
relatedBy: NSLayoutRelation.equal,
attribute: NSLayoutConstraint.Attribute.centerY,
relatedBy: NSLayoutConstraint.Relation.equal,
toItem: contentView,
attribute: NSLayoutAttribute.centerY,
attribute: NSLayoutConstraint.Attribute.centerY,
multiplier: 1,
constant: 0
)
)
contentView.addConstraint(
NSLayoutConstraint(
item: view,
attribute: NSLayoutAttribute.centerX,
relatedBy: NSLayoutRelation.equal,
attribute: NSLayoutConstraint.Attribute.centerX,
relatedBy: NSLayoutConstraint.Relation.equal,
toItem: contentView,
attribute: NSLayoutAttribute.centerX,
attribute: NSLayoutConstraint.Attribute.centerX,
multiplier: 1,
constant: 0
)
Expand All @@ -387,15 +387,15 @@ public class ParallaxHeader: NSObject {
contentView.addConstraints(
NSLayoutConstraint.constraints(
withVisualFormat: "H:|[v]|",
options: NSLayoutFormatOptions(rawValue: 0),
options: NSLayoutConstraint.FormatOptions(rawValue: 0),
metrics: nil,
views: binding
)
)
contentView.addConstraints(
NSLayoutConstraint.constraints(
withVisualFormat: "V:[v(==height)]|",
options: NSLayoutFormatOptions(rawValue: 0),
options: NSLayoutConstraint.FormatOptions(rawValue: 0),
metrics: metrics,
views: binding
)
Expand All @@ -413,15 +413,15 @@ public class ParallaxHeader: NSObject {
contentView.addConstraints(
NSLayoutConstraint.constraints(
withVisualFormat: "H:|[v]|",
options: NSLayoutFormatOptions(rawValue: 0),
options: NSLayoutConstraint.FormatOptions(rawValue: 0),
metrics: nil,
views: binding
)
)
contentView.addConstraints(
NSLayoutConstraint.constraints(
withVisualFormat: "V:|-0.0@highPriority-[v(>=height)]|",
options: NSLayoutFormatOptions(rawValue: 0),
options: NSLayoutConstraint.FormatOptions(rawValue: 0),
metrics: metrics,
views: binding
)
Expand Down