-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Making utility extensions public (#21)
* Making utility extensions public * Bumping release in README
- Loading branch information
Showing
5 changed files
with
50 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// Array.swift | ||
// GigaBitcoin/secp256k1.swift | ||
// | ||
// Copyright (c) 2020 GigaBitcoin LLC | ||
// Distributed under the MIT software license | ||
// | ||
// See the accompanying file LICENSE for information | ||
// | ||
|
||
public extension Array where Element == UInt8 { | ||
/// Public initializer backed by the `BytesUtil.swift` Array extension | ||
/// - Parameter hex: hexadecimal string to initialize | ||
/// - Throws: `ByteHexEncodingErrors` for invalid string or hex value | ||
init(hex: String) throws { | ||
self.init() | ||
// The `BytesUtil.swift` Array extension expects lowercase strings | ||
self = try Array(hexString: hex.lowercased()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// Data.swift | ||
// GigaBitcoin/secp256k1.swift | ||
// | ||
// Copyright (c) 2020 GigaBitcoin LLC | ||
// Distributed under the MIT software license | ||
// | ||
// See the accompanying file LICENSE for information | ||
// | ||
|
||
import Foundation | ||
|
||
public extension DataProtocol { | ||
/// Public property backed by the `BytesUtil.swift` DataProtocol extension property `hexString` | ||
var hex: String { | ||
hexString | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters