Skip to content
This repository was archived by the owner on Dec 2, 2022. It is now read-only.

Commit d2e430e

Browse files
committed
Merge pull request #35 from pvzig/feature/model-object-improvements
1.1.0
2 parents 3ed139b + ebe169b commit d2e430e

28 files changed

+724
-740
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
![SlackKit](https://cloud.githubusercontent.com/assets/8311605/10260893/5ec60f96-694e-11e5-91fd-da6845942201.png)
2-
##iOS/OS X Slack Client Library
2+
##iOS, OS X, and tvOS Slack Client Library
33
###Description
44
This is a Slack client library for OS X, iOS, and tvOS written in Swift. It's intended to expose all of the functionality of Slack's [Real Time Messaging API](https://api.slack.com/rtm) as well as the [web APIs](https://api.slack.com/web) that are accessible by [bot users](https://api.slack.com/bot-users).
55

@@ -32,7 +32,7 @@ carthage bootstrap
3232
carthage bootstrap --configuration "Debug"
3333
```
3434

35-
Drag the built `SlackKit.framework`, `SlackKit_iOS.framework`, or `SlackKit_tvOS.framework` into your Xcode project.
35+
Drag the built `SlackKit.framework` into your Xcode project.
3636

3737
####Swift Package Manager
3838
Add SlackKit to your Package.swift

SlackKit.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "SlackKit"
3-
s.version = "1.0.3"
3+
s.version = "1.1.0"
44
s.summary = "a Slack client library for OS X, iOS, and tvOS written in Swift"
55
s.homepage = "https://github.com/pvzig/SlackKit"
66
s.license = 'MIT'

SlackKit.xcodeproj/project.pbxproj

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@
8787
260EC2301C4DC61D0093B253 /* Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Extensions.swift; path = Sources/Extensions.swift; sourceTree = "<group>"; };
8888
260EC2311C4DC61D0093B253 /* NetworkInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = NetworkInterface.swift; path = Sources/NetworkInterface.swift; sourceTree = "<group>"; };
8989
260EC2321C4DC61D0093B253 /* SlackWebAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SlackWebAPI.swift; path = Sources/SlackWebAPI.swift; sourceTree = "<group>"; };
90-
263993B21CE90EE0004A6E93 /* SlackKit_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SlackKit_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
91-
263993D11CE90EED004A6E93 /* SlackKit_tvOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SlackKit_tvOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
90+
263993B21CE90EE0004A6E93 /* SlackKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SlackKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
91+
263993D11CE90EED004A6E93 /* SlackKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SlackKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
9292
2661A6A41BBF62FF0026F67B /* SlackKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SlackKit.h; sourceTree = "<group>"; };
9393
268E46131CE8F79D009F19CC /* Info-iOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Info-iOS.plist"; path = "Supporting Files/Info-iOS.plist"; sourceTree = "<group>"; };
9494
268E46141CE8F79D009F19CC /* Info-tvOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Info-tvOS.plist"; path = "Supporting Files/Info-tvOS.plist"; sourceTree = "<group>"; };
@@ -174,8 +174,8 @@
174174
children = (
175175
26072A341BB48B3A00CD650C /* SlackKit.framework */,
176176
2601D6241C7688610012BF22 /* OSX-Sample.app */,
177-
263993B21CE90EE0004A6E93 /* SlackKit_iOS.framework */,
178-
263993D11CE90EED004A6E93 /* SlackKit_tvOS.framework */,
177+
263993B21CE90EE0004A6E93 /* SlackKit.framework */,
178+
263993D11CE90EED004A6E93 /* SlackKit.framework */,
179179
);
180180
name = Products;
181181
sourceTree = "<group>";
@@ -187,8 +187,8 @@
187187
26BBA1871C398E3C00BF7225 /* Bot.swift */,
188188
26BBA1881C398E3C00BF7225 /* Channel.swift */,
189189
26BBA1891C398E3C00BF7225 /* Client.swift */,
190-
C1A85FF81CE3BCEF00756C40 /* Client+EventHandling.swift */,
191190
C1A85FF71CE3BCEF00756C40 /* Client+EventDispatching.swift */,
191+
C1A85FF81CE3BCEF00756C40 /* Client+EventHandling.swift */,
192192
C16C98791CE7D3DD00692776 /* Client+Utilities.swift */,
193193
26BBA18A1C398E3C00BF7225 /* Event.swift */,
194194
26BBA18B1C398E3C00BF7225 /* EventDelegate.swift */,
@@ -273,9 +273,9 @@
273273
productReference = 2601D6241C7688610012BF22 /* OSX-Sample.app */;
274274
productType = "com.apple.product-type.application";
275275
};
276-
26072A331BB48B3A00CD650C /* SlackKit */ = {
276+
26072A331BB48B3A00CD650C /* SlackKit OS X */ = {
277277
isa = PBXNativeTarget;
278-
buildConfigurationList = 26072A3C1BB48B3B00CD650C /* Build configuration list for PBXNativeTarget "SlackKit" */;
278+
buildConfigurationList = 26072A3C1BB48B3B00CD650C /* Build configuration list for PBXNativeTarget "SlackKit OS X" */;
279279
buildPhases = (
280280
26072A2F1BB48B3A00CD650C /* Sources */,
281281
26072A301BB48B3A00CD650C /* Frameworks */,
@@ -286,14 +286,14 @@
286286
);
287287
dependencies = (
288288
);
289-
name = SlackKit;
289+
name = "SlackKit OS X";
290290
productName = SlackRTMKit;
291291
productReference = 26072A341BB48B3A00CD650C /* SlackKit.framework */;
292292
productType = "com.apple.product-type.framework";
293293
};
294-
263993951CE90EE0004A6E93 /* SlackKit_iOS */ = {
294+
263993951CE90EE0004A6E93 /* SlackKit iOS */ = {
295295
isa = PBXNativeTarget;
296-
buildConfigurationList = 263993AF1CE90EE0004A6E93 /* Build configuration list for PBXNativeTarget "SlackKit_iOS" */;
296+
buildConfigurationList = 263993AF1CE90EE0004A6E93 /* Build configuration list for PBXNativeTarget "SlackKit iOS" */;
297297
buildPhases = (
298298
263993961CE90EE0004A6E93 /* Sources */,
299299
263993AA1CE90EE0004A6E93 /* Frameworks */,
@@ -304,14 +304,14 @@
304304
);
305305
dependencies = (
306306
);
307-
name = SlackKit_iOS;
307+
name = "SlackKit iOS";
308308
productName = SlackRTMKit;
309-
productReference = 263993B21CE90EE0004A6E93 /* SlackKit_iOS.framework */;
309+
productReference = 263993B21CE90EE0004A6E93 /* SlackKit.framework */;
310310
productType = "com.apple.product-type.framework";
311311
};
312-
263993B41CE90EED004A6E93 /* SlackKit_tvOS */ = {
312+
263993B41CE90EED004A6E93 /* SlackKit tvOS */ = {
313313
isa = PBXNativeTarget;
314-
buildConfigurationList = 263993CE1CE90EED004A6E93 /* Build configuration list for PBXNativeTarget "SlackKit_tvOS" */;
314+
buildConfigurationList = 263993CE1CE90EED004A6E93 /* Build configuration list for PBXNativeTarget "SlackKit tvOS" */;
315315
buildPhases = (
316316
263993B51CE90EED004A6E93 /* Sources */,
317317
263993C91CE90EED004A6E93 /* Frameworks */,
@@ -322,9 +322,9 @@
322322
);
323323
dependencies = (
324324
);
325-
name = SlackKit_tvOS;
325+
name = "SlackKit tvOS";
326326
productName = SlackRTMKit;
327-
productReference = 263993D11CE90EED004A6E93 /* SlackKit_tvOS.framework */;
327+
productReference = 263993D11CE90EED004A6E93 /* SlackKit.framework */;
328328
productType = "com.apple.product-type.framework";
329329
};
330330
/* End PBXNativeTarget section */
@@ -358,9 +358,9 @@
358358
projectDirPath = "";
359359
projectRoot = "";
360360
targets = (
361-
26072A331BB48B3A00CD650C /* SlackKit */,
362-
263993951CE90EE0004A6E93 /* SlackKit_iOS */,
363-
263993B41CE90EED004A6E93 /* SlackKit_tvOS */,
361+
26072A331BB48B3A00CD650C /* SlackKit OS X */,
362+
263993951CE90EE0004A6E93 /* SlackKit iOS */,
363+
263993B41CE90EED004A6E93 /* SlackKit tvOS */,
364364
2601D6231C7688610012BF22 /* OSX-Sample */,
365365
);
366366
};
@@ -682,7 +682,7 @@
682682
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
683683
MACOSX_DEPLOYMENT_TARGET = 10.10;
684684
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
685-
PRODUCT_NAME = "$(TARGET_NAME)";
685+
PRODUCT_NAME = SlackKit;
686686
SDKROOT = iphoneos;
687687
SKIP_INSTALL = YES;
688688
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
@@ -710,7 +710,7 @@
710710
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
711711
MACOSX_DEPLOYMENT_TARGET = 10.10;
712712
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
713-
PRODUCT_NAME = "$(TARGET_NAME)";
713+
PRODUCT_NAME = SlackKit;
714714
SDKROOT = iphoneos;
715715
SKIP_INSTALL = YES;
716716
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
@@ -736,7 +736,7 @@
736736
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
737737
MACOSX_DEPLOYMENT_TARGET = 10.10;
738738
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
739-
PRODUCT_NAME = "$(TARGET_NAME)";
739+
PRODUCT_NAME = SlackKit;
740740
SDKROOT = appletvos;
741741
SKIP_INSTALL = YES;
742742
SUPPORTED_PLATFORMS = "appletvsimulator appletvos";
@@ -764,7 +764,7 @@
764764
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
765765
MACOSX_DEPLOYMENT_TARGET = 10.10;
766766
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
767-
PRODUCT_NAME = "$(TARGET_NAME)";
767+
PRODUCT_NAME = SlackKit;
768768
SDKROOT = appletvos;
769769
SKIP_INSTALL = YES;
770770
SUPPORTED_PLATFORMS = "appletvsimulator appletvos";
@@ -793,7 +793,7 @@
793793
defaultConfigurationIsVisible = 0;
794794
defaultConfigurationName = Release;
795795
};
796-
26072A3C1BB48B3B00CD650C /* Build configuration list for PBXNativeTarget "SlackKit" */ = {
796+
26072A3C1BB48B3B00CD650C /* Build configuration list for PBXNativeTarget "SlackKit OS X" */ = {
797797
isa = XCConfigurationList;
798798
buildConfigurations = (
799799
26072A3D1BB48B3B00CD650C /* Debug */,
@@ -802,7 +802,7 @@
802802
defaultConfigurationIsVisible = 0;
803803
defaultConfigurationName = Release;
804804
};
805-
263993AF1CE90EE0004A6E93 /* Build configuration list for PBXNativeTarget "SlackKit_iOS" */ = {
805+
263993AF1CE90EE0004A6E93 /* Build configuration list for PBXNativeTarget "SlackKit iOS" */ = {
806806
isa = XCConfigurationList;
807807
buildConfigurations = (
808808
263993B01CE90EE0004A6E93 /* Debug */,
@@ -811,7 +811,7 @@
811811
defaultConfigurationIsVisible = 0;
812812
defaultConfigurationName = Release;
813813
};
814-
263993CE1CE90EED004A6E93 /* Build configuration list for PBXNativeTarget "SlackKit_tvOS" */ = {
814+
263993CE1CE90EED004A6E93 /* Build configuration list for PBXNativeTarget "SlackKit tvOS" */ = {
815815
isa = XCConfigurationList;
816816
buildConfigurations = (
817817
263993CF1CE90EED004A6E93 /* Debug */,

SlackKit.xcodeproj/xcshareddata/xcschemes/SlackKit.xcscheme renamed to SlackKit.xcodeproj/xcshareddata/xcschemes/SlackKit OS X.xcscheme

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
BuildableIdentifier = "primary"
1717
BlueprintIdentifier = "26072A331BB48B3A00CD650C"
1818
BuildableName = "SlackKit.framework"
19-
BlueprintName = "SlackKit"
19+
BlueprintName = "SlackKit OS X"
2020
ReferencedContainer = "container:SlackKit.xcodeproj">
2121
</BuildableReference>
2222
</BuildActionEntry>
@@ -47,7 +47,7 @@
4747
BuildableIdentifier = "primary"
4848
BlueprintIdentifier = "26072A331BB48B3A00CD650C"
4949
BuildableName = "SlackKit.framework"
50-
BlueprintName = "SlackKit"
50+
BlueprintName = "SlackKit OS X"
5151
ReferencedContainer = "container:SlackKit.xcodeproj">
5252
</BuildableReference>
5353
</MacroExpansion>
@@ -65,7 +65,7 @@
6565
BuildableIdentifier = "primary"
6666
BlueprintIdentifier = "26072A331BB48B3A00CD650C"
6767
BuildableName = "SlackKit.framework"
68-
BlueprintName = "SlackKit"
68+
BlueprintName = "SlackKit OS X"
6969
ReferencedContainer = "container:SlackKit.xcodeproj">
7070
</BuildableReference>
7171
</MacroExpansion>

SlackKit.xcodeproj/xcshareddata/xcschemes/SlackKit_iOS.xcscheme renamed to SlackKit.xcodeproj/xcshareddata/xcschemes/SlackKit iOS.xcscheme

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
<BuildableReference
1616
BuildableIdentifier = "primary"
1717
BlueprintIdentifier = "263993951CE90EE0004A6E93"
18-
BuildableName = "SlackKit_iOS.framework"
19-
BlueprintName = "SlackKit_iOS"
18+
BuildableName = "SlackKit.framework"
19+
BlueprintName = "SlackKit iOS"
2020
ReferencedContainer = "container:SlackKit.xcodeproj">
2121
</BuildableReference>
2222
</BuildActionEntry>
@@ -46,8 +46,8 @@
4646
<BuildableReference
4747
BuildableIdentifier = "primary"
4848
BlueprintIdentifier = "263993951CE90EE0004A6E93"
49-
BuildableName = "SlackKit_iOS.framework"
50-
BlueprintName = "SlackKit_iOS"
49+
BuildableName = "SlackKit.framework"
50+
BlueprintName = "SlackKit iOS"
5151
ReferencedContainer = "container:SlackKit.xcodeproj">
5252
</BuildableReference>
5353
</MacroExpansion>
@@ -64,8 +64,8 @@
6464
<BuildableReference
6565
BuildableIdentifier = "primary"
6666
BlueprintIdentifier = "263993951CE90EE0004A6E93"
67-
BuildableName = "SlackKit_iOS.framework"
68-
BlueprintName = "SlackKit_iOS"
67+
BuildableName = "SlackKit.framework"
68+
BlueprintName = "SlackKit iOS"
6969
ReferencedContainer = "container:SlackKit.xcodeproj">
7070
</BuildableReference>
7171
</MacroExpansion>

SlackKit.xcodeproj/xcshareddata/xcschemes/SlackKit_tvOS.xcscheme renamed to SlackKit.xcodeproj/xcshareddata/xcschemes/SlackKit tvOS.xcscheme

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
<BuildableReference
1616
BuildableIdentifier = "primary"
1717
BlueprintIdentifier = "263993B41CE90EED004A6E93"
18-
BuildableName = "SlackKit_tvOS.framework"
19-
BlueprintName = "SlackKit_tvOS"
18+
BuildableName = "SlackKit.framework"
19+
BlueprintName = "SlackKit tvOS"
2020
ReferencedContainer = "container:SlackKit.xcodeproj">
2121
</BuildableReference>
2222
</BuildActionEntry>
@@ -46,8 +46,8 @@
4646
<BuildableReference
4747
BuildableIdentifier = "primary"
4848
BlueprintIdentifier = "263993B41CE90EED004A6E93"
49-
BuildableName = "SlackKit_tvOS.framework"
50-
BlueprintName = "SlackKit_tvOS"
49+
BuildableName = "SlackKit.framework"
50+
BlueprintName = "SlackKit tvOS"
5151
ReferencedContainer = "container:SlackKit.xcodeproj">
5252
</BuildableReference>
5353
</MacroExpansion>
@@ -64,8 +64,8 @@
6464
<BuildableReference
6565
BuildableIdentifier = "primary"
6666
BlueprintIdentifier = "263993B41CE90EED004A6E93"
67-
BuildableName = "SlackKit_tvOS.framework"
68-
BlueprintName = "SlackKit_tvOS"
67+
BuildableName = "SlackKit.framework"
68+
BlueprintName = "SlackKit tvOS"
6969
ReferencedContainer = "container:SlackKit.xcodeproj">
7070
</BuildableReference>
7171
</MacroExpansion>

SlackKit/Sources/Attachment.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public struct Attachment {
3838
public let imageURL: String?
3939
public let thumbURL: String?
4040

41-
internal init?(attachment: [String: AnyObject]?) {
41+
internal init(attachment: [String: AnyObject]?) {
4242
fallback = attachment?["fallback"] as? String
4343
color = attachment?["color"] as? String
4444
pretext = attachment?["pretext"] as? String
@@ -50,12 +50,10 @@ public struct Attachment {
5050
text = attachment?["text"] as? String
5151
imageURL = attachment?["image_url"] as? String
5252
thumbURL = attachment?["thumb_url"] as? String
53-
fields = (attachment?["fields"] as? [[String: AnyObject]])?.objectArrayFromDictionaryArray({(field) -> AttachmentField? in
54-
return AttachmentField(field: field)
55-
})
53+
fields = (attachment?["fields"] as? [[String: AnyObject]])?.map { AttachmentField(field: $0) }
5654
}
5755

58-
public init?(fallback: String, title:String, colorHex: String? = nil, pretext: String? = nil, authorName: String? = nil, authorLink: String? = nil, authorIcon: String? = nil, titleLink: String? = nil, text: String? = nil, fields: [AttachmentField]? = nil, imageURL: String? = nil, thumbURL: String? = nil) {
56+
public init(fallback: String, title:String, colorHex: String? = nil, pretext: String? = nil, authorName: String? = nil, authorLink: String? = nil, authorIcon: String? = nil, titleLink: String? = nil, text: String? = nil, fields: [AttachmentField]? = nil, imageURL: String? = nil, thumbURL: String? = nil) {
5957
self.fallback = fallback
6058
self.color = colorHex
6159
self.pretext = pretext
@@ -105,7 +103,7 @@ public struct AttachmentField {
105103
public let value: String?
106104
public let short: Bool?
107105

108-
internal init?(field: [String: AnyObject]?) {
106+
internal init(field: [String: AnyObject]?) {
109107
title = field?["title"] as? String
110108
value = field?["value"] as? String
111109
short = field?["short"] as? Bool

SlackKit/Sources/Bot.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public struct Bot {
2727
internal(set) public var name: String?
2828
internal(set) public var icons: [String: AnyObject]?
2929

30-
internal init?(bot: [String: AnyObject]?) {
30+
internal init(bot: [String: AnyObject]?) {
3131
id = bot?["id"] as? String
3232
name = bot?["name"] as? String
3333
icons = bot?["icons"] as? [String: AnyObject]

SlackKit/Sources/Channel.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public struct Channel {
4949
internal(set) public var usersTyping = [String]()
5050
internal(set) public var messages = [String: Message]()
5151

52-
internal init?(channel: [String: AnyObject]?) {
52+
internal init(channel: [String: AnyObject]?) {
5353
id = channel?["id"] as? String
5454
name = channel?["name"] as? String
5555
created = channel?["created"] as? Int
@@ -70,15 +70,15 @@ public struct Channel {
7070
unreadCountDisplay = channel?["unread_count_display"] as? Int
7171
hasPins = channel?["has_pins"] as? Bool
7272
members = channel?["members"] as? [String]
73-
74-
if (Message(message: channel?["latest"] as? [String: AnyObject])?.ts == nil) {
75-
latest = Message(ts: channel?["latest"] as? String)
73+
74+
if let latestMsgDictionary = channel?["latest"] as? [String: AnyObject] {
75+
latest = Message(message: latestMsgDictionary)
7676
} else {
77-
latest = Message(message: channel?["latest"] as? [String: AnyObject])
77+
latest = Message(ts: channel?["latest"] as? String)
7878
}
7979
}
8080

81-
internal init?(id:String?) {
81+
internal init(id:String?) {
8282
self.id = id
8383
created = nil
8484
creator = nil

0 commit comments

Comments
 (0)