Skip to content
This repository was archived by the owner on Oct 14, 2018. It is now read-only.

Commit 71a9428

Browse files
authored
Merge pull request #27 from AnderGoig/develop
Version 1.1.1
2 parents 3b9ed7d + ae16050 commit 71a9428

File tree

114 files changed

+1005
-769
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1005
-769
lines changed

.assets/Getting-Started.png

100644100755
File mode changed.

.assets/Info.plist-File.png

100644100755
File mode changed.

.assets/SwiftInstagram-Logo.png

100644100755
File mode changed.

.assets/SwiftInstagram-Logo.psd

100644100755
File mode changed.

.codebeatignore

100644100755
File mode changed.

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Declare files that will always have CRLF line endings on checkout.
5+
*.swift text eol=lf

.github/CONTRIBUTING.md

100644100755
File mode changed.

.github/ISSUE_TEMPLATE.md

100644100755
File mode changed.

.github/PULL_REQUEST_TEMPLATE.md

100644100755
File mode changed.

.gitignore

100644100755
File mode changed.

.gitmodules

100644100755
File mode changed.

.jazzy.yaml

100644100755
File mode changed.

.swift-version

100644100755
File mode changed.

.swiftlint.yml

100644100755
File mode changed.

.travis.yml

100644100755
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: objective-c
2-
osx_image: xcode9
2+
osx_image: xcode9.3beta
33
git:
44
submodules: false
55
env:
@@ -8,7 +8,7 @@ env:
88
- LANG=en_US.UTF-8
99
- WORKSPACE=SwiftInstagram.xcworkspace
1010
- SCHEME="SwiftInstagram-iOS"
11-
- SDK=iphonesimulator11.0
11+
- SDK=iphonesimulator11.3
1212
matrix:
1313
- TEST_TYPE=iOS
1414
- TEST_TYPE=Lint
@@ -45,7 +45,7 @@ script:
4545
set -o pipefail
4646
xcodebuild -version
4747
xcodebuild -showsdks
48-
xcodebuild build -workspace "$WORKSPACE" -scheme "$SCHEME" -sdk "$SDK" -configuration Debug -destination "platform=iOS Simulator,name=iPhone 5" -destination "platform=iOS Simulator,name=iPhone 7 Plus" | xcpretty -c
48+
xcodebuild build -workspace "$WORKSPACE" -scheme "$SCHEME" -sdk "$SDK" -configuration Debug -destination "platform=iOS Simulator,name=iPhone 8 Plus" | xcpretty -c
4949
elif [ "$TEST_TYPE" = Lint ]; then
5050
swiftlint lint
5151
elif [ "$TEST_TYPE" = CocoaPods ]; then

CHANGELOG.md

100644100755
File mode changed.

CODE_OF_CONDUCT.md

100644100755
File mode changed.

Cartfile

100644100755
File mode changed.

Cartfile.private

100644100755
File mode changed.

Cartfile.resolved

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
github "Quick/Nimble" "v7.0.3"
22
github "Quick/Quick" "v1.2.0"
3-
github "jspahrsummers/xcconfigs" "94d261a58a034f70fe207298fffb8ee790c4bbd9"
3+
github "jspahrsummers/xcconfigs" "bb795558a76e5daf3688500055bbcfe243bffa8d"

Carthage/Checkouts/xcconfigs

Gemfile

100644100755
File mode changed.

LICENSE

100644100755
File mode changed.

Package.swift

100644100755
File mode changed.

README.md

100644100755
File mode changed.

Sources/Endpoints/Comments.swift

100644100755
File mode changed.

Sources/Endpoints/Likes.swift

100644100755
File mode changed.

Sources/Endpoints/Locations.swift

100644100755
File mode changed.

Sources/Endpoints/Media.swift

100644100755
File mode changed.

Sources/Endpoints/Relationships.swift

100644100755
File mode changed.

Sources/Endpoints/Tags.swift

100644100755
File mode changed.

Sources/Endpoints/Users.swift

100644100755
File mode changed.

Sources/Extensions/Array+SwiftInstagram.swift

100644100755
File mode changed.

Sources/Extensions/Data+SwiftInstagram.swift

100644100755
File mode changed.

Sources/Extensions/Dictionary+SwiftInstagram.swift

100644100755
File mode changed.

Sources/Extensions/Optional+SwiftInstagram.swift

100644100755
File mode changed.

Sources/Extensions/URL+SwiftInstagram.swift

100644100755
File mode changed.

Sources/Helpers/KeychainSwiftDistrib.swift

100644100755
File mode changed.

Sources/Instagram.swift

100644100755
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@ public class Instagram {
1313

1414
// MARK: - Types
1515

16+
/// Empty success handler
1617
public typealias EmptySuccessHandler = () -> Void
18+
19+
/// Success handler
1720
public typealias SuccessHandler<T> = (_ data: T) -> Void
21+
22+
/// Failure handler
1823
public typealias FailureHandler = (_ error: Error) -> Void
1924

2025
private enum API {
@@ -138,7 +143,9 @@ public class Instagram {
138143
if let data = data {
139144
DispatchQueue.global(qos: .utility).async {
140145
do {
141-
let object = try JSONDecoder().decode(InstagramResponse<T>.self, from: data)
146+
let jsonDecoder = JSONDecoder()
147+
jsonDecoder.keyDecodingStrategy = .convertFromSnakeCase
148+
let object = try jsonDecoder.decode(InstagramResponse<T>.self, from: data)
142149

143150
if let data = object.data {
144151
DispatchQueue.main.async {

Sources/InstagramScope.swift

100644100755
File mode changed.

Sources/Models/InstagramComment.swift

100644100755
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ public struct InstagramComment: Decodable {
2626
// MARK: - Types
2727

2828
private enum CodingKeys: String, CodingKey {
29-
case id, text, from
30-
case createdTime = "created_time"
29+
case id, text, from, createdTime
3130
}
3231

3332
// MARK: - Initializers

Sources/Models/InstagramError.swift

100644100755
File mode changed.

Sources/Models/InstagramLocation.swift

100644100755
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ public struct InstagramLocation<T: Decodable>: Decodable {
2828
// MARK: - Types
2929

3030
private enum CodingKeys: String, CodingKey {
31-
case id, name, latitude, longitude
32-
case streetAddress = "street_address"
31+
case id, name, streetAddress, latitude, longitude
3332
}
3433

3534
// MARK: - Initializers

Sources/Models/InstagramMedia.swift

100644100755
Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,6 @@ public struct InstagramMedia: Decodable {
9797

9898
/// A Resolution object that contains the width, height and URL of the standard resolution image.
9999
public let standardResolution: Resolution
100-
101-
private enum CodingKeys: String, CodingKey {
102-
case thumbnail
103-
case lowResolution = "low_resolution"
104-
case standardResolution = "standard_resolution"
105-
}
106100
}
107101

108102
/// A struct cointaining the low and standard resolution videos of the media.
@@ -116,24 +110,25 @@ public struct InstagramMedia: Decodable {
116110

117111
/// A Resolution object that contains the width, height and URL of the low bandwidth video.
118112
public let lowBandwidth: Resolution?
119-
120-
private enum CodingKeys: String, CodingKey {
121-
case lowResolution = "low_resolution"
122-
case standardResolution = "standard_resolution"
123-
case lowBandwidth = "low_bandwidth"
124-
}
125113
}
126114

127115
/// A struct containing the user and its position on the image.
128116
public struct UserInPhoto: Decodable {
129117

130118
/// The user that appears in the image.
131-
public let user: InstagramUser
119+
public let user: UserInPhotoUsername
132120

133121
/// The position in points of the user in the image.
134122
public let position: Position
135123

136-
/// A struct that containing the value of the coordinate axes, 'x' and 'y'.
124+
/// A struct containing the username of the tagged user.
125+
public struct UserInPhotoUsername: Decodable {
126+
127+
/// The value of the x-axis.
128+
public let username: String
129+
}
130+
131+
/// A struct containing the value of the coordinate axes, 'x' and 'y'.
137132
public struct Position: Decodable {
138133

139134
/// The value of the x-axis.
@@ -158,19 +153,11 @@ public struct InstagramMedia: Decodable {
158153

159154
/// The type of media. It can be "image" or "video".
160155
public let type: String
161-
162-
private enum CodingKeys: String, CodingKey {
163-
case images, videos, type
164-
case usersInPhoto = "users_in_photo"
165-
}
166156
}
167157

168158
private enum CodingKeys: String, CodingKey {
169-
case id, user, type, images, videos, caption, comments, likes, tags, filter, link, location, distance
170-
case createdTime = "created_time"
171-
case userHasLiked = "user_has_liked"
172-
case usersInPhoto = "users_in_photo"
173-
case carouselMedia = "carousel_media"
159+
case id, user, createdTime, type, images, videos, caption, comments, likes, tags,
160+
userHasLiked, filter, link, location, usersInPhoto, carouselMedia, distance
174161
}
175162

176163
// MARK: - Initializers

Sources/Models/InstagramRelationship.swift

100644100755
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,4 @@ public struct InstagramRelationship: Decodable {
1616

1717
/// A user's relationship to you. It can be "followed_by", "requested_by", "blocked_by_you" or "none".
1818
public let incomingStatus: String?
19-
20-
// MARK: - Types
21-
22-
private enum CodingKeys: String, CodingKey {
23-
case outgoingStatus = "outgoing_status"
24-
case incomingStatus = "incoming_status"
25-
}
26-
2719
}

Sources/Models/InstagramResponse.swift

100644100755
Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,11 @@ struct InstagramResponse<T: Decodable>: Decodable {
2020
let code: Int
2121
let errorType: String?
2222
let errorMessage: String?
23-
24-
private enum CodingKeys: String, CodingKey {
25-
case code
26-
case errorType = "error_type"
27-
case errorMessage = "error_message"
28-
}
2923
}
3024

3125
struct Pagination: Decodable {
32-
let nextURL: String?
26+
let nextUrl: String?
3327
let nextMaxId: String?
34-
35-
private enum CodingKeys: String, CodingKey {
36-
case nextURL = "next_url"
37-
case nextMaxId = "next_max_id"
38-
}
3928
}
4029
}
4130

Sources/Models/InstagramTag.swift

100644100755
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,4 @@ public struct InstagramTag: Decodable {
1616

1717
/// The number of media in which the tag appears.
1818
public let mediaCount: Int
19-
20-
// MARK: - Types
21-
22-
private enum CodingKeys: String, CodingKey {
23-
case name
24-
case mediaCount = "media_count"
25-
}
2619
}

Sources/Models/InstagramUser.swift

100644100755
Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,5 @@ public struct InstagramUser: Decodable {
4848

4949
/// The number of followers of the user.
5050
public let followedBy: Int
51-
52-
private enum CodingKeys: String, CodingKey {
53-
case media, follows
54-
case followedBy = "followed_by"
55-
}
56-
}
57-
58-
private enum CodingKeys: String, CodingKey {
59-
case id, username, bio, website, counts
60-
case profilePicture = "profile_picture"
61-
case fullName = "full_name"
62-
case isBusiness = "is_business"
6351
}
6452
}

Sources/Supporting Files/Info.plist

100644100755
File mode changed.

Sources/Supporting Files/SwiftInstagram.h

100644100755
File mode changed.

Sources/Views/InstagramLoginViewController.swift

100644100755
File mode changed.

SwiftInstagram.podspec

100644100755
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 = 'SwiftInstagram'
3-
s.version = '1.1.0'
3+
s.version = '1.1.1'
44
s.cocoapods_version = '>= 1.1.0'
55
s.authors = { 'Ander Goig' => 'goig.ander@gmail.com' }
66
s.license = { :type => 'MIT', :file => 'LICENSE' }

SwiftInstagram.xcodeproj/project.xcworkspace/contents.xcworkspacedata

100644100755
File mode changed.

SwiftInstagram.xcodeproj/xcshareddata/IDETemplateMacros.plist

100644100755
File mode changed.

SwiftInstagram.xcodeproj/xcshareddata/xcschemes/SwiftInstagram-iOS.xcscheme

100644100755
File mode changed.

SwiftInstagram.xcworkspace/contents.xcworkspacedata

100644100755
File mode changed.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

Tests/Info.plist

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>BNDL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.1.0</string>
18+
<string>1.1.1</string>
1919
<key>CFBundleVersion</key>
2020
<string>1</string>
2121
</dict>

Tests/SwiftInstagramSpec.swift

100644100755
File mode changed.

docs/API.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ <h1>API</h1>
161161
<h4>Declaration</h4>
162162
<div class="language">
163163
<p class="aside-title">Swift</p>
164-
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">Instagram</span></code></pre>
164+
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">Instagram</span></code></pre>
165165

166166
</div>
167167
</div>
@@ -176,8 +176,8 @@ <h4>Declaration</h4>
176176
</article>
177177
</div>
178178
<section class="footer">
179-
<p>&copy; 2018 <a class="link" href="https://github.com/AnderGoig" target="_blank" rel="external">Ander Goig</a>. All rights reserved. (Last updated: 2018-01-21)</p>
180-
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.4</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
179+
<p>&copy; 2018 <a class="link" href="https://github.com/AnderGoig" target="_blank" rel="external">Ander Goig</a>. All rights reserved. (Last updated: 2018-04-06)</p>
180+
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
181181
</section>
182182
</body>
183183
</div>

docs/Authentication.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ <h1>Authentication</h1>
161161
<h4>Declaration</h4>
162162
<div class="language">
163163
<p class="aside-title">Swift</p>
164-
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">InstagramScope</span><span class="p">:</span> <span class="kt">String</span></code></pre>
164+
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">InstagramScope</span><span class="p">:</span> <span class="kt">String</span></code></pre>
165165

166166
</div>
167167
</div>
@@ -176,8 +176,8 @@ <h4>Declaration</h4>
176176
</article>
177177
</div>
178178
<section class="footer">
179-
<p>&copy; 2018 <a class="link" href="https://github.com/AnderGoig" target="_blank" rel="external">Ander Goig</a>. All rights reserved. (Last updated: 2018-01-21)</p>
180-
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.4</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
179+
<p>&copy; 2018 <a class="link" href="https://github.com/AnderGoig" target="_blank" rel="external">Ander Goig</a>. All rights reserved. (Last updated: 2018-04-06)</p>
180+
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
181181
</section>
182182
</body>
183183
</div>

0 commit comments

Comments
 (0)