Skip to content

Commit

Permalink
Changed margins
Browse files Browse the repository at this point in the history
  • Loading branch information
impresyjna authored Nov 26, 2019
1 parent 9c2f88b commit ca47ef5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ImpressiveNotifications/Sources/INNotifications.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ public class INNotifications {
let horizontalMargin = customStyle?.horizontalMargin ?? 16.0

var constraints = [
NSLayoutConstraint(item: notificationView , attribute: .leading, relatedBy: .equal, toItem: unwrappedWindow, attribute: .leadingMargin, multiplier: 1.0, constant: verticalMargin),
NSLayoutConstraint(item: notificationView , attribute: .trailing, relatedBy: .equal, toItem: unwrappedWindow, attribute: .trailingMargin, multiplier: 1.0, constant: -1*verticalMargin)
NSLayoutConstraint(item: notificationView , attribute: .leading, relatedBy: .equal, toItem: unwrappedWindow, attribute: .leadingMargin, multiplier: 1.0, constant: horizontalMargin),
NSLayoutConstraint(item: notificationView , attribute: .trailing, relatedBy: .equal, toItem: unwrappedWindow, attribute: .trailingMargin, multiplier: 1.0, constant: -1*horizontalMargin)
]

switch position {
case .top:
constraints.append(NSLayoutConstraint(item: notificationView , attribute: .top, relatedBy: .equal, toItem: unwrappedWindow, attribute: .topMargin, multiplier: 1.0, constant: horizontalMargin))
constraints.append(NSLayoutConstraint(item: notificationView , attribute: .top, relatedBy: .equal, toItem: unwrappedWindow, attribute: .topMargin, multiplier: 1.0, constant: verticalMargin))
case .bottom:
constraints.append(NSLayoutConstraint(item: notificationView , attribute: .bottom, relatedBy: .equal, toItem: unwrappedWindow, attribute: .bottomMargin, multiplier: 1.0, constant: -1*horizontalMargin))
constraints.append(NSLayoutConstraint(item: notificationView , attribute: .bottom, relatedBy: .equal, toItem: unwrappedWindow, attribute: .bottomMargin, multiplier: 1.0, constant: -1*verticalMargin))
}

NSLayoutConstraint.activate(constraints)
Expand Down

0 comments on commit ca47ef5

Please sign in to comment.