Skip to content

Commit

Permalink
Merge pull request #47 from satoshi-takano/add_public_initializer
Browse files Browse the repository at this point in the history
Add public initializer to OpenGraph class
  • Loading branch information
satoshi-takano authored Mar 24, 2021
2 parents 08a9c0e + 89a6673 commit eee5aeb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion OpenGraph.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "OpenGraph"
s.version = "1.2.3"
s.version = "1.3.0"
s.summary = "A Swift wrapper for the Open Graph protocol."
s.homepage = "https://github.com/satoshi-takano/OpenGraph"
s.license = {
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenGraph/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.3.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
7 changes: 5 additions & 2 deletions Sources/OpenGraph/OpenGraph.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ public struct OpenGraph {
completion(.success(og))
}
}

public init(htmlString: String) {
self = OpenGraph(htmlString: htmlString, parser: DefaultOpenGraphParser())
}

init(htmlString: String, injector: () -> OpenGraphParser = { DefaultOpenGraphParser() }) {
let parser = injector()
init(htmlString: String, parser: OpenGraphParser) {
source = parser.parse(htmlString: htmlString)
}

Expand Down

0 comments on commit eee5aeb

Please sign in to comment.