Skip to content

Commit

Permalink
👌 Simplify switch, fix comment, fix test double imports
Browse files Browse the repository at this point in the history
  • Loading branch information
iujames committed Sep 13, 2023
1 parent 61fd061 commit 0d26345
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,17 @@ extension AppcuesModalTrait.Config {
let horizontalAlign = style?.horizontalAlignment ?? "center"
let verticalAlign = style?.verticalAlignment ?? "center"

switch horizontalAlign {
case "leading":
switch (horizontalAlign, verticalAlign) {
case ("leading", _):
edge = .leading
case "trailing":
case ("trailing", _):
edge = .trailing
case (_, "top"):
edge = .top
case (_, "bottom"):
edge = .bottom
default:
switch verticalAlign {
case "top":
edge = .top
case "bottom":
edge = .bottom
default:
edge = .center
}
edge = .center
}

return .slide(edge: edge)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ internal class ExperienceWrapperViewController<BodyView: ExperienceWrapperView>:

if let width = style?.width, width > 0 {
let widthConstraint = contentView.widthAnchor.constraint(equalToConstant: width)
// lower priority here so that the constraint on width being >= the readableContentGuide width
// lower priority here so that the constraint on width being <= the readableContentGuide width
// set in the ExperienceWrapperView by default takes priority, if width is too large
widthConstraint.priority = .init(999)
widthConstraint.isActive = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
import XCTest
@testable import AppcuesKit

import XCTest
@testable import AppcuesKit

@available(iOS 13.0, *)
class ExperienceWrapperSlideAnimatorTests: XCTestCase {

Expand Down

0 comments on commit 0d26345

Please sign in to comment.