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

Add the ml_ prefix support #23

Open
wants to merge 1 commit 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
1 change: 0 additions & 1 deletion .swift-version

This file was deleted.

3 changes: 2 additions & 1 deletion ManualLayout.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'ManualLayout'
s.version = '1.3.0'
s.version = '1.3.1'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.summary = 'Easy to use and flexible AutoLayout alternative for iOS 8+. Supports AsyncDisplayKit.'

Expand All @@ -14,4 +14,5 @@ Pod::Spec.new do |s|
s.source_files = 'ManualLayout'
s.frameworks = 'UIKit'
s.requires_arc = true
s.swift_version = "5.0"
end
21 changes: 13 additions & 8 deletions ManualLayout.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -545,7 +546,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.bsencan.ManualLayout.SimpleExample.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -559,7 +560,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.bsencan.ManualLayout.SimpleExample.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -580,7 +581,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.bsencan.ManualLayout.SimpleExample.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SimpleExample.app/SimpleExample";
};
name = Debug;
Expand All @@ -599,7 +600,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.bsencan.ManualLayout.SimpleExample.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SimpleExample.app/SimpleExample";
};
name = Release;
Expand Down Expand Up @@ -648,6 +649,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -690,6 +692,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 @@ -714,7 +717,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -734,7 +737,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.bsencan.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -753,7 +756,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.bsencan.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -768,7 +771,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.bsencan.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -791,6 +794,7 @@
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand All @@ -814,6 +818,7 @@
PRODUCT_NAME = ManualLayout;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand Down
225 changes: 136 additions & 89 deletions ManualLayout/CALayer+ManualLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,116 +8,163 @@

import UIKit

public extension CALayer {
extension CALayer {

// MARK: - Position

public var origin: CGPoint {
get {
return frame.origin
// MARK: - Position
public var ml_origin: CGPoint {
get { return frame.origin }
set { ml_x = newValue.x; ml_y = newValue.y }
}
set {
x = newValue.x
y = newValue.y
public var origin: CGPoint {
get { return ml_origin }
set { ml_origin = newValue }
}
}

public var x: CGFloat {
get { return frame.x }
set { frame.x = newValue }
}

public var y: CGFloat {
get { return frame.y }
set { frame.y = newValue }
}

public var center: CGPoint {
get { return frame.center }
set { frame.center = newValue }
}

public var centerX: CGFloat {
get { return frame.centerX }
set { frame.centerX = newValue }
}

public var centerY: CGFloat {
get { return frame.centerY }
set { frame.centerY = newValue }
}

// MARK: - Size
public var ml_x: CGFloat {
get { return frame.ml_x }
set { frame.ml_x = newValue }
}
public var x: CGFloat {
get { return ml_x }
set { ml_x = newValue }
}

public var size: CGSize {
get {
return frame.size
public var ml_y: CGFloat {
get { return frame.ml_y }
set { frame.ml_y = newValue }
}
set {
width = newValue.width
height = newValue.height
public var y: CGFloat {
get { return ml_y }
set { ml_y = newValue }
}
}

public var width: CGFloat {
get {
return frame.size.width
public var ml_center: CGPoint {
get { return frame.ml_center }
set { frame.ml_center = newValue }
}
set {
frame.size.width = snapToPixel(pointCoordinate: newValue)
public var center: CGPoint {
get { return ml_center }
set { ml_center = newValue }
}

public var ml_centerX: CGFloat {
get { return frame.ml_centerX }
set { frame.ml_centerX = newValue }
}
public var centerX: CGFloat {
get { return ml_centerX }
set { ml_centerX = newValue }
}

public var ml_centerY: CGFloat {
get { return frame.ml_centerY }
set { frame.ml_centerY = newValue }
}
public var centerY: CGFloat {
get { return ml_centerY }
set { ml_centerY = newValue }
}
}

public var height: CGFloat {
get {
return frame.size.height
// MARK: - Size
public var ml_size: CGSize {
get { return frame.size }
set { ml_width = newValue.width; ml_height = newValue.height }
}
set {
frame.size.height = snapToPixel(pointCoordinate: newValue)
public var size: CGSize {
get { return ml_size }
set { ml_size = newValue }
}
}

// MARK: - Edges
public var ml_width: CGFloat {
get { return frame.size.width }
set { frame.size.width = snapToPixel(pointCoordinate: newValue) }
}
public var width: CGFloat {
get { return ml_width }
set { ml_width = newValue }
}

public var top: CGFloat {
get { return frame.top }
set { frame.top = newValue }
}
public var ml_height: CGFloat {
get { return frame.size.height }
set { frame.size.height = snapToPixel(pointCoordinate: newValue) }
}
public var height: CGFloat {
get { return ml_height }
set { ml_height = newValue }
}

public var right: CGFloat {
get { return frame.right }
set { frame.right = newValue }
}
// MARK: - Edges
public var ml_top: CGFloat {
get { return frame.ml_top }
set { frame.ml_top = newValue }
}
public var top: CGFloat {
get { return ml_top }
set { ml_top = newValue }
}

public var bottom: CGFloat {
get { return frame.bottom }
set { frame.bottom = newValue }
}
public var ml_right: CGFloat {
get { return frame.right }
set { frame.right = newValue }
}
public var right: CGFloat {
get { return ml_right }
set { ml_right = newValue }
}

public var left: CGFloat {
get { return frame.left }
set { frame.left = newValue }
}
public var ml_bottom: CGFloat {
get { return frame.bottom }
set { frame.bottom = newValue }
}
public var bottom: CGFloat {
get { return ml_bottom }
set { ml_bottom = newValue }
}

// MARK: - Alternative Edges
public var ml_left: CGFloat {
get { return frame.left }
set { frame.left = newValue }
}
public var left: CGFloat {
get { return ml_left }
set { ml_left = newValue }
}

public var top2: CGFloat {
get { return frame.top2 }
set { frame.top2 = newValue }
}
// MARK: - Alternative Edges
public var ml_top2: CGFloat {
get { return frame.ml_top2 }
set { frame.ml_top2 = newValue }
}
public var top2: CGFloat {
get { return ml_top2 }
set { ml_top2 = newValue }
}

public var right2: CGFloat {
get { return frame.right2 }
set { frame.right2 = newValue }
}
public var ml_right2: CGFloat {
get { return frame.ml_right2 }
set { frame.ml_right2 = newValue }
}
public var right2: CGFloat {
get { return ml_right2 }
set { ml_right2 = newValue }
}

public var bottom2: CGFloat {
get { return frame.bottom2 }
set { frame.bottom2 = newValue }
}
public var ml_bottom2: CGFloat {
get { return frame.ml_bottom2 }
set { frame.ml_bottom2 = newValue }
}
public var bottom2: CGFloat {
get { return ml_bottom2 }
set { ml_bottom2 = newValue }
}

public var left2: CGFloat {
get { return frame.left2 }
set { frame.left2 = newValue }
}
public var ml_left2: CGFloat {
get { return frame.ml_left2 }
set { frame.ml_left2 = newValue }
}
public var left2: CGFloat {
get { return ml_left2 }
set { ml_left2 = newValue }
}

}
Loading