-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from OpenStack-mobile/develop
Release v2.3.3
- Loading branch information
Showing
43 changed files
with
1,194 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// Link.swift | ||
// OpenStack Summit | ||
// | ||
// Created by Alsey Coleman Miller on 5/5/17. | ||
// Copyright © 2017 OpenStack. All rights reserved. | ||
// | ||
|
||
public struct Link: PresentationMaterial { | ||
|
||
public let identifier: Identifier | ||
|
||
public var name: String | ||
|
||
public var descriptionText: String? | ||
|
||
public var displayOnSite: Bool | ||
|
||
public var featured: Bool | ||
|
||
public var order: Int | ||
|
||
public var link: String | ||
|
||
public var event: Identifier | ||
} | ||
|
||
// MARK: - Equatable | ||
|
||
public func == (lhs: Link, rhs: Link) -> Bool { | ||
|
||
return lhs.identifier == rhs.identifier | ||
&& lhs.name == rhs.name | ||
&& lhs.descriptionText == rhs.descriptionText | ||
&& lhs.displayOnSite == rhs.displayOnSite | ||
&& lhs.featured == rhs.featured | ||
&& lhs.order == rhs.order | ||
&& lhs.link == rhs.link | ||
&& lhs.event == rhs.event | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// | ||
// LinkJSON.swift | ||
// OpenStack Summit | ||
// | ||
// Created by Alsey Coleman Miller on 5/5/17. | ||
// Copyright © 2017 OpenStack. All rights reserved. | ||
// | ||
|
||
import SwiftFoundation | ||
|
||
public extension Link { | ||
|
||
enum JSONKey: String { | ||
|
||
case id, name, description, display_on_site, featured, order, presentation_id, link | ||
} | ||
} | ||
|
||
extension Link: JSONDecodable { | ||
|
||
public init?(JSONValue: JSON.Value) { | ||
|
||
guard let JSONObject = JSONValue.objectValue, | ||
let identifier = JSONObject[JSONKey.id.rawValue]?.rawValue as? Int, | ||
let featured = JSONObject[JSONKey.featured.rawValue]?.rawValue as? Bool, | ||
let displayOnSite = JSONObject[JSONKey.display_on_site.rawValue]?.rawValue as? Bool, | ||
let presentation = JSONObject[JSONKey.presentation_id.rawValue]?.rawValue as? Identifier, | ||
let order = JSONObject[JSONKey.order.rawValue]?.rawValue as? Int, | ||
let link = JSONObject[JSONKey.link.rawValue]?.rawValue as? String | ||
else { return nil } | ||
|
||
self.identifier = identifier | ||
self.featured = featured | ||
self.displayOnSite = displayOnSite | ||
self.event = presentation | ||
self.order = order | ||
self.link = link | ||
|
||
// optional | ||
self.name = JSONObject[JSONKey.name.rawValue]?.rawValue as? String ?? "" | ||
|
||
if let descriptionText = JSONObject[JSONKey.description.rawValue]?.rawValue as? String | ||
where descriptionText.isEmpty == false { | ||
|
||
self.descriptionText = descriptionText | ||
|
||
} else { | ||
|
||
self.descriptionText = nil | ||
} | ||
} | ||
} |
Oops, something went wrong.