Skip to content
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

Fix Swift 4.1 Compatibility #114

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
27 changes: 26 additions & 1 deletion Example/LiquidFloatingActionButton.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
attributes = {
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
LastUpgradeCheck = 0940;
ORGANIZATIONNAME = CocoaPods;
TargetAttributes = {
607FACCF1AFB9204008FA782 = {
Expand Down Expand Up @@ -414,13 +414,23 @@
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 @@ -459,13 +469,23 @@
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 @@ -484,6 +504,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -492,6 +513,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 80EF48C45D584D0DAE9D6988 /* Pods-LiquidFloatingActionButton_Example.debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 5BNC8N825B;
INFOPLIST_FILE = LiquidFloatingActionButton/Info.plist;
Expand All @@ -508,6 +530,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 386F17A74F71B30EC9A19FE2 /* Pods-LiquidFloatingActionButton_Example.release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 5BNC8N825B;
INFOPLIST_FILE = LiquidFloatingActionButton/Info.plist;
Expand All @@ -524,6 +547,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = EA315BFAE52E692548EF4579 /* Pods-LiquidFloatingActionButton_Tests.debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
Expand All @@ -546,6 +570,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = E99FC56FB6D1F023BC78CC25 /* Pods-LiquidFloatingActionButton_Tests.release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
LastUpgradeVersion = "0940"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -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>
46 changes: 41 additions & 5 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

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

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

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

1 change: 1 addition & 0 deletions LiquidFloatingActionButton.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/yoavlt/LiquidFloatingActionButton.git", :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

s.swift_version = "4.1"
s.platform = :ios, '8.0'
s.requires_arc = true

Expand Down
8 changes: 4 additions & 4 deletions Pod/Classes/LiquidFloatingActionButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ open class LiquidFloatingActionButton : UIView {

// rotate plus icon
CATransaction.setAnimationDuration(0.8)
self.plusLayer.transform = CATransform3DMakeRotation((CGFloat(M_PI) * rotationDegrees) / 180, 0, 0, 1)
self.plusLayer.transform = CATransform3DMakeRotation((CGFloat(Double.pi) * rotationDegrees) / 180, 0, 0, 1)

let cells = cellArray()
for cell in cells {
Expand Down Expand Up @@ -375,12 +375,12 @@ class CircleLiquidBaseView : ActionBarBaseView {
}

if let firstCell = openingCells.first {
bigEngine?.push(circle: baseLiquid!, other: firstCell)
_ = bigEngine?.push(circle: baseLiquid!, other: firstCell)
}
for i in 1..<openingCells.count {
let prev = openingCells[i - 1]
let cell = openingCells[i]
engine?.push(circle: prev, other: cell)
_ = engine?.push(circle: prev, other: cell)
}
engine?.draw(parent: baseLiquid!)
bigEngine?.draw(parent: baseLiquid!)
Expand Down Expand Up @@ -437,7 +437,7 @@ class CircleLiquidBaseView : ActionBarBaseView {
return -1 * t * (t - 2)
}

func didDisplayRefresh(_ displayLink: CADisplayLink) {
@objc func didDisplayRefresh(_ displayLink: CADisplayLink) {
if opening {
keyDuration += CGFloat(displayLink.duration)
updateOpen()
Expand Down
4 changes: 2 additions & 2 deletions Pod/Classes/LiquidUtil.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ extension CALayer {
class CGMath {

static func radToDeg(_ rad: CGFloat) -> CGFloat {
return rad * 180 / CGFloat(M_PI)
return rad * 180 / CGFloat(Double.pi)
}

static func degToRad(_ deg: CGFloat) -> CGFloat {
return deg * CGFloat(M_PI) / 180
return deg * CGFloat(Double.pi) / 180
}

static func circlePoint(_ center: CGPoint, radius: CGFloat, rad: CGFloat) -> CGPoint {
Expand Down
2 changes: 1 addition & 1 deletion Pod/Classes/LiquittableCircle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ open class LiquittableCircle : UIView {

func drawCircle() {
let bezierPath = UIBezierPath(ovalIn: CGRect(origin: CGPoint.zero, size: CGSize(width: radius * 2, height: radius * 2)))
draw(bezierPath)
_ = draw(bezierPath)
}

func draw(_ path: UIBezierPath) -> CAShapeLayer {
Expand Down
2 changes: 1 addition & 1 deletion Pod/Classes/SimpleCircleLiquidEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class SimpleCircleLiquidEngine {
private func circleConnectedPoint(circle: LiquittableCircle, other: LiquittableCircle) -> (CGPoint, CGPoint) {
var ratio = circleRatio(circle: circle, other: other)
ratio = (ratio + ConnectThresh) / (1.0 + ConnectThresh)
let angle = CGFloat(M_PI_2) * angleOpen * ratio
let angle = CGFloat(Double.pi/2.0) * angleOpen * ratio
return circleConnectedPoint(circle: circle, other: other, angle: angle)
}

Expand Down