diff --git a/Docs.md b/Docs.md index 1db23043..988f4716 100644 --- a/Docs.md +++ b/Docs.md @@ -115,6 +115,17 @@ _Objective-C_: [giphy setMediaConfigWithTypes: [[ NSMutableArray alloc] initWithObjects: @(GPHContentTypeGifs), @(GPHContentTypeStickers), @(GPHContentTypeText), @(GPHContentTypeEmoji), nil ] ]; ``` +- **Recently Picked**: + +As of `v1.2.5`, you can add an additional `GPHContentType` to the `mediaTypeConfig` array: `.recents` + +```swift +giphy.mediaTypeConfig = [.gifs, .stickers, .recents] +``` + +GIFs that are selected by the user are automatically added to the recents tab, which is only displayed if the user has previously picked a gif. + +Users can remove gifs from recents with a long-press on the GIF in the recents grid. - **Confirmation screen**: we provide the option to show a secondary confirmation screen when the user taps a GIF, which shows a larger rendition of the asset. This confirmation screen is only available for `.waterfall` mode - this property will be ignored if the `layout` is `.carousel`. @@ -340,14 +351,36 @@ let emoji = GPHContent.emoji ``` ##### Search -``` +``` let search = GPHContent.search(withQuery: "Hello", mediaType: .gif, language: .english) ``` - + +##### Recents + +Show GIFs that the user has previously picked. +``` +let recentlyPicked = GPHContent.recents +``` + +Only show a "recents" tab if there are any recents. Get the number of recents via: +``` +let numberOfRecents = GPHRecents.count +``` + +Optionally, we also provide the option to clear the set of recents: + +``` +GPHRecents.clear() +``` + +##### Updating the content + Set the grid controller's `content` property and call update: ``` gridController.content = GPHContent.search(withQuery: "Sup", mediaType: .text, language: .english) gridController.update() + + ``` #### GiphyGridController: GPHGridDelegate diff --git a/Swift/Example/ContentTypeSettingCell.swift b/Swift/Example/ContentTypeSettingCell.swift index fc669b44..3672e3bf 100644 --- a/Swift/Example/ContentTypeSettingCell.swift +++ b/Swift/Example/ContentTypeSettingCell.swift @@ -101,6 +101,8 @@ class ContentTypeSettingCell: UICollectionViewCell { case .stickers: button.setTitle("Stickers", for: .normal) case .text: button.setTitle("Text", for: .normal) case .emoji: button.setTitle("Emoji", for: .normal) + case .recents: button.setTitle("Recents", for: .normal) + @unknown default: break } buttons.append(button) button.addTarget(self, action: #selector(buttonSelected(button:)), for: .touchUpInside) diff --git a/Swift/Podfile b/Swift/Podfile index e5a3add0..fc6e9476 100644 --- a/Swift/Podfile +++ b/Swift/Podfile @@ -1,4 +1,5 @@ use_frameworks! target "Example" do pod 'Giphy' + end diff --git a/Swift/Podfile.lock b/Swift/Podfile.lock index 71bdb815..c371e8f4 100644 --- a/Swift/Podfile.lock +++ b/Swift/Podfile.lock @@ -1,6 +1,6 @@ PODS: - DeepDiff (2.3.1) - - Giphy (1.2.3): + - Giphy (1.2.5): - DeepDiff - libwebp - PINCache @@ -27,10 +27,10 @@ SPEC REPOS: SPEC CHECKSUMS: DeepDiff: e5ae6c50d0321568e4508cec5930b9f10bb293fc - Giphy: 622540676cee6939daec392cdf59f786ef9a7bdd + Giphy: 76a033587d9291d5e6d2001897bd8fb11840c7df libwebp: 946cb3063cea9236285f7e9a8505d806d30e07f3 PINCache: ce36ed282031b92fc7733ffe831f474ff80fddc2 -PODFILE CHECKSUM: d659713d06e820a4ac8d6a631ef9c1ab030fdb5c +PODFILE CHECKSUM: 4df53eea3b338c70feb8cedc06b59db69f449c91 COCOAPODS: 1.8.4