Skip to content
This repository has been archived by the owner on Jan 18, 2025. It is now read-only.

Commit

Permalink
Bump to version 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonardoCardoso committed Jan 2, 2019
1 parent 81b032a commit 62eaefc
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 26 deletions.
14 changes: 7 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Change Log

#### 3.x Releases
- `3.0.0`
- `3.0.x` Releases - [3.0.0](#300)

#### 2.x Releases
- `2.3.x` Releases - [2.3.0](#230) | [2.3.1](#231) | [2.3.2](#232)
- `2.3.x` Releases - [2.3.0](#230) | [2.3.1](#231)
- `2.2.x` Releases - [2.2.0](#220)
- `2.1.x` Releases - [2.1.0](#210)
- `2.0.x` Releases - [2.0.0](#200) | [2.0.1](#201) | [2.0.2](#202) | [2.0.3](#203) | [2.0.4](#204) | [2.0.5](#205) | [2.0.6](#206) | [2.0.7](#207)
Expand All @@ -18,20 +18,20 @@

---

## 2.3.2(https://github.com/LeonardoCardoso/Swift-Link-Preview/releases/tag/2.3.2)
Released on 2018-10-09.
## [3.0.0](https://github.com/LeonardoCardoso/Swift-Link-Preview/releases/tag/3.0.0)
Released on 2019-01-02.

#### Changed
#### Added

- Added isVideo() check
- Added by [Onur Genes](https://github.com/onurgenes)

## 3.0.0
#### Changed
- Response is now a swift `struct` instead of a `Dictionary<String, Any>`
- Moving to Swift 4.2
- Changed by [Giuseppe Travasoni](https://github.com/neobeppe)

## 2.3.1(https://github.com/LeonardoCardoso/Swift-Link-Preview/releases/tag/2.3.1)
## [2.3.1](https://github.com/LeonardoCardoso/Swift-Link-Preview/releases/tag/2.3.1)
Released on 2018-09-23.

#### Changed
Expand Down
35 changes: 24 additions & 11 deletions Example/SwiftLinkPreviewExample/Controllers/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ViewController: UIViewController {
"Well, it's a gif! https://goo.gl/jKCPgp"
]

private var result = SwiftLinkPreview.Response()
private var result = Response()
private let placeholderImages = [ImageSource(image: UIImage(named: "Placeholder")!)]

private let slp = SwiftLinkPreview(cache: InMemoryCache())
Expand Down Expand Up @@ -127,7 +127,7 @@ class ViewController: UIViewController {

private func setData() {

if let value: [String] = self.result[.images] as? [String] {
if let value = self.result.images {

if !value.isEmpty {

Expand All @@ -146,17 +146,17 @@ class ViewController: UIViewController {

} else {

self.setImage(image: self.result[.image] as? String)
self.setImage(image: self.result.image)

}

} else {

self.setImage(image: self.result[.image] as? String)
self.setImage(image: self.result.image)

}

if let value: String = self.result[.title] as? String {
if let value: String = self.result.title {

self.previewTitle?.text = value.isEmpty ? "No title" : value

Expand All @@ -166,13 +166,13 @@ class ViewController: UIViewController {

}

if let value: String = self.result[.canonicalUrl] as? String {
if let value: String = self.result.canonicalUrl {

self.previewCanonicalUrl?.text = value

}

if let value: String = self.result[.description] as? String {
if let value: String = self.result.description {

self.previewDescription?.text = value.isEmpty ? "No description" : value

Expand All @@ -182,7 +182,7 @@ class ViewController: UIViewController {

}

if let value: String = self.result[.icon] as? String, let url = URL(string: value) {
if let value: String = self.result.icon, let url = URL(string: value) {
self.favicon?.af_setImage(withURL: url)
}

Expand Down Expand Up @@ -256,6 +256,18 @@ class ViewController: UIViewController {
}

@IBAction func submitAction(_ sender: AnyObject) {

func printResult(_ result: Response) {
print("url: ", result.url ?? "no url")
print("finalUrl: ", result.finalUrl ?? "no finalUrl")
print("canonicalUrl: ", result.canonicalUrl ?? "no canonicalUrl")
print("title: ", result.title ?? "no title")
print("images: ", result.images ?? "no images")
print("image: ", result.image ?? "no image")
print("video: ", result.video ?? "no video")
print("icon: ", result.icon ?? "no icon")
print("description: ", result.description ?? "no description")
}

guard textField?.text?.isEmpty == false else {

Expand All @@ -274,14 +286,15 @@ class ViewController: UIViewController {
self.result = cached
self.setData()

result.forEach { print("\($0):", $1) }
printResult(result)

} else {
self.slp.preview(
textFieldText,
onSuccess: { result in

result.forEach { print("\($0):", $1) }
printResult(result)

self.result = result
self.setData()

Expand All @@ -301,7 +314,7 @@ class ViewController: UIViewController {

@IBAction func openWithAction(_ sender: UIButton) {

if let url = self.result[.finalUrl] as? URL {
if let url = self.result.finalUrl {

UIApplication.shared.open(url, options: [:], completionHandler: nil)

Expand Down
2 changes: 1 addition & 1 deletion Example/SwiftLinkPreviewExample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2.3.1</string>
<string>3.0.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
> It makes a preview from an URL, grabbing all the information such as title, relevant texts and images.
[![Platform](https://img.shields.io/badge/platform-iOS%20|%20macOS%20|%20watchOS%20|%20tvOS-orange.svg)](https://github.com/LeonardoCardoso/SwiftLinkPreview#requirements-and-details)
[![CocoaPods](https://img.shields.io/badge/pod-v2.3.1-red.svg)](https://github.com/LeonardoCardoso/SwiftLinkPreview#cocoapods)
[![CocoaPods](https://img.shields.io/badge/pod-v3.0.0-red.svg)](https://github.com/LeonardoCardoso/SwiftLinkPreview#cocoapods)
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg)](https://github.com/LeonardoCardoso/SwiftLinkPreview#carthage)
[![Swift Package Manager](https://img.shields.io/badge/SPM-compatible-orange.svg)](https://github.com/LeonardoCardoso/SwiftLinkPreview#swift-package-manager)
[![Build Status](https://travis-ci.org/LeonardoCardoso/SwiftLinkPreview.svg?branch=master)](https://travis-ci.org/LeonardoCardoso/SwiftLinkPreview)
Expand Down Expand Up @@ -59,7 +59,7 @@ To use **SwiftLinkPreview** as a pod package just add the following in your **Po
target 'Your Target Name' do
use_frameworks!
// ...
pod 'SwiftLinkPreview', '~> 2.3.1'
pod 'SwiftLinkPreview', '~> 3.0.0'
// ...
end
```
Expand All @@ -70,7 +70,7 @@ To use **SwiftLinkPreview** as a Carthage module package just add the following

```ruby
// ...
github "LeonardoCardoso/SwiftLinkPreview" ~> 2.3.1
github "LeonardoCardoso/SwiftLinkPreview" ~> 3.0.0
// ...
```

Expand All @@ -85,7 +85,7 @@ let package = Package(
name: "Your Target Name",
dependencies: [
// ...
.Package(url: "https://github.com/LeonardoCardoso/SwiftLinkPreview.git", "2.3.1")
.Package(url: "https://github.com/LeonardoCardoso/SwiftLinkPreview.git", "3.0.0")
// ...
]
)
Expand Down
3 changes: 3 additions & 0 deletions Sources/Response.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ public struct Response {
public internal(set) var image: String?
public internal(set) var icon: String?
public internal(set) var video: String?

public init() { }

}
2 changes: 1 addition & 1 deletion SwiftLinkPreviewTests/Info-macOS.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>2.3.1</string>
<string>3.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion SwiftLinkPreviewTests/Info-tvOS.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>2.3.1</string>
<string>3.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion SwiftLinkPreviewTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>2.3.1</string>
<string>3.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down

0 comments on commit 62eaefc

Please sign in to comment.