Skip to content

Commit

Permalink
app: add an initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonycastelli committed Sep 6, 2018
1 parent 117e10e commit 2d4d6ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions Sources/OneSignal/OneSignalApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ public struct OneSignalApp: Codable {

public var apiKey: String
public var appId: String

public init(apiKey: String, appId: String) {
self.apiKey = apiKey
self.appId = appId
}
}
8 changes: 4 additions & 4 deletions Sources/OneSignal/OneSignalNotification.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ public struct OneSignalNotification: Codable {
self.users = users
}

public init(title: String, subtitle: String, message: String, users: [String], sound: String? = nil, category: String? = nil) {
self.title = OneSignalMessage(title)
self.subtitle = OneSignalMessage(subtitle)
self.message = OneSignalMessage(message)
public init(title: String?, subtitle: String?, body: String, users: [String], sound: String? = nil, category: String? = nil) {
if let title = title { self.title = OneSignalMessage(title) }
if let subtitle = subtitle { self.subtitle = OneSignalMessage(subtitle) }
self.message = OneSignalMessage(body)
self.users = users
self.sound = sound
self.category = category
Expand Down

0 comments on commit 2d4d6ab

Please sign in to comment.