Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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
15 changes: 8 additions & 7 deletions 15 Source/ConstraintInsetTarget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,20 @@ extension ConstraintInsets: ConstraintInsetTarget {
extension ConstraintInsetTarget {

internal var constraintInsetTargetValue: ConstraintInsets {
if let amount = self as? ConstraintInsets {
switch self {
case let amount as ConstraintInsets:
return amount
} else if let amount = self as? Float {
case let amount as Float:
return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
} else if let amount = self as? Double {
case let amount as Double:
return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
} else if let amount = self as? CGFloat {
case let amount as CGFloat:
return ConstraintInsets(top: amount, left: amount, bottom: amount, right: amount)
} else if let amount = self as? Int {
case let amount as Int:
return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
} else if let amount = self as? UInt {
case let amount as UInt:
return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
} else {
default:
return ConstraintInsets(top: 0, left: 0, bottom: 0, right: 0)
}
}
Expand Down
13 changes: 7 additions & 6 deletions 13 Source/ConstraintOffsetTarget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,18 @@ extension ConstraintOffsetTarget {

internal var constraintOffsetTargetValue: CGFloat {
let offset: CGFloat
if let amount = self as? Float {
switch self {
case let amount as Float:
offset = CGFloat(amount)
} else if let amount = self as? Double {
case let amount as Double:
offset = CGFloat(amount)
} else if let amount = self as? CGFloat {
case let amount as CGFloat:
offset = CGFloat(amount)
} else if let amount = self as? Int {
case let amount as Int:
offset = CGFloat(amount)
} else if let amount = self as? UInt {
case let amount as UInt:
offset = CGFloat(amount)
} else {
default:
offset = 0.0
}
return offset
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.