Skip to content

Commit 5d6a6df

Browse files
committed
Merge branch 'release/3.4.0' into versions
2 parents 50b84f0 + e11aed5 commit 5d6a6df

Some content is hidden

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

46 files changed

+2471
-2366
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries se
1919

2020
## [Unreleased]
2121
### Added
22-
- Added `round(fractionDigits:rule:)` & `rounded(fractionDigits:rule:)` methods to `Double` type.
23-
Author: [Cihat Gündüz](https://github.com/Jeehut)
22+
- None.
2423
### Changed
2524
- None.
2625
### Deprecated
@@ -32,6 +31,11 @@ Author: [Cihat Gündüz](https://github.com/Jeehut)
3231
### Security
3332
- None.
3433

34+
## [3.4.0] - 2021-09-28
35+
### Added
36+
- Added new convenience `encrypt(key:)` and `decrypt(key:)` functions to `String` type for platforms supporting `CryptoKit`. Uses AES.GCM algorithm for encryption.
37+
Author: [Cihat Gündüz](https://github.com/Jeehut)
38+
3539
## [3.3.0] - 2021-01-16
3640
### Added
3741
- Added `round(fractionDigits:rule:)` & `rounded(fractionDigits:rule:)` methods to `Double` type.

HandySwift.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = "HandySwift"
4-
s.version = "3.3.0"
4+
s.version = "3.4.0"
55
s.summary = "Handy Swift features that didn't make it into the Swift standard library"
66

77
s.description = <<-DESC

HandySwift.xcodeproj/project.pbxproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
2E61DF7E249E1D37000AF3C5 /* WithableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E61DF7D249E1D37000AF3C5 /* WithableTests.swift */; };
2929
2E61DF7F249E1D37000AF3C5 /* WithableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E61DF7D249E1D37000AF3C5 /* WithableTests.swift */; };
3030
2E61DF80249E1D37000AF3C5 /* WithableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E61DF7D249E1D37000AF3C5 /* WithableTests.swift */; };
31+
2E86A32025E5943800845C6D /* DataExt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E86A31F25E5943800845C6D /* DataExt.swift */; };
32+
2E86A32125E5943800845C6D /* DataExt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E86A31F25E5943800845C6D /* DataExt.swift */; };
33+
2E86A32225E5943800845C6D /* DataExt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E86A31F25E5943800845C6D /* DataExt.swift */; };
3134
3F95C8D220F22A3C0045AFD0 /* CollectionExt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F95C8D120F22A3C0045AFD0 /* CollectionExt.swift */; };
3235
3F95C8D520F22DEE0045AFD0 /* CollectionExtTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F95C8D320F22DC60045AFD0 /* CollectionExtTests.swift */; };
3336
3F95C8D620F22DEF0045AFD0 /* CollectionExtTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F95C8D320F22DC60045AFD0 /* CollectionExtTests.swift */; };
@@ -156,6 +159,7 @@
156159
2E5A375325655F55003704D0 /* StringProtocolExt.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringProtocolExt.swift; sourceTree = "<group>"; };
157160
2E61DF79249E1CA9000AF3C5 /* Withable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Withable.swift; sourceTree = "<group>"; };
158161
2E61DF7D249E1D37000AF3C5 /* WithableTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WithableTests.swift; sourceTree = "<group>"; };
162+
2E86A31F25E5943800845C6D /* DataExt.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataExt.swift; sourceTree = "<group>"; };
159163
3F95C8D120F22A3C0045AFD0 /* CollectionExt.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionExt.swift; sourceTree = "<group>"; };
160164
3F95C8D320F22DC60045AFD0 /* CollectionExtTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionExtTests.swift; sourceTree = "<group>"; };
161165
63651F8F231BFF2000E022DA /* DivisibleArithmetic.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DivisibleArithmetic.swift; sourceTree = "<group>"; };
@@ -284,7 +288,9 @@
284288
A1F5AEEA1E05700F003D6949 /* RootFiles */,
285289
823B2B321C24AAB6007B3CDD /* Products */,
286290
);
291+
indentWidth = 4;
287292
sourceTree = "<group>";
293+
tabWidth = 4;
288294
};
289295
823B2B321C24AAB6007B3CDD /* Products */ = {
290296
isa = PBXGroup;
@@ -305,6 +311,7 @@
305311
82CAE2951C2EE64900F934A7 /* ArrayExt.swift */,
306312
3F95C8D120F22A3C0045AFD0 /* CollectionExt.swift */,
307313
CC66E046228199A0007ABF61 /* ComparableExt.swift */,
314+
2E86A31F25E5943800845C6D /* DataExt.swift */,
308315
8280D7DB1C4A6EC9001172EF /* DictionaryExt.swift */,
309316
A1F221631E3CC05100419B06 /* DispatchTimeIntervalExt.swift */,
310317
2E18AD592531DD3D00D44748 /* DoubleExt.swift */,
@@ -783,6 +790,7 @@
783790
CC120CC2205FDB9300C37D7C /* Regex.swift in Sources */,
784791
826F69AC1C3895A300B2CC6B /* FrequencyTable.swift in Sources */,
785792
2E18B292242DECCA000C7776 /* NSObjectExt.swift in Sources */,
793+
2E86A32025E5943800845C6D /* DataExt.swift in Sources */,
786794
A1F221641E3CC05100419B06 /* DispatchTimeIntervalExt.swift in Sources */,
787795
8218E4D62211D193007AAAF3 /* NSRangeExt.swift in Sources */,
788796
3F95C8D220F22A3C0045AFD0 /* CollectionExt.swift in Sources */,
@@ -833,6 +841,7 @@
833841
CC120CC3205FDC4C00C37D7C /* Regex.swift in Sources */,
834842
C5CFB6AD20B0A70300830511 /* Unowned.swift in Sources */,
835843
2E18B293242DECCA000C7776 /* NSObjectExt.swift in Sources */,
844+
2E86A32125E5943800845C6D /* DataExt.swift in Sources */,
836845
826F69AD1C3895A300B2CC6B /* FrequencyTable.swift in Sources */,
837846
8218E4D72211D193007AAAF3 /* NSRangeExt.swift in Sources */,
838847
825EFE051C33358400558497 /* StringExt.swift in Sources */,
@@ -883,6 +892,7 @@
883892
CC120CC4205FDC4D00C37D7C /* Regex.swift in Sources */,
884893
C5CFB6AE20B0A70300830511 /* Unowned.swift in Sources */,
885894
2E18B294242DECCA000C7776 /* NSObjectExt.swift in Sources */,
895+
2E86A32225E5943800845C6D /* DataExt.swift in Sources */,
886896
826F69AE1C3895A300B2CC6B /* FrequencyTable.swift in Sources */,
887897
8218E4D82211D193007AAAF3 /* NSRangeExt.swift in Sources */,
888898
825EFE0B1C33358500558497 /* StringExt.swift in Sources */,

Package.swift

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,12 @@
22
import PackageDescription
33

44
let package = Package(
5-
name: "HandySwift",
6-
products: [
7-
.library(name: "HandySwift", targets: ["HandySwift"])
8-
],
9-
targets: [
10-
.target(
11-
name: "HandySwift",
12-
exclude: ["Sources/SupportingFiles"]
13-
),
14-
.testTarget(
15-
name: "HandySwiftTests",
16-
dependencies: ["HandySwift"],
17-
exclude: ["Tests/SupportingFiles"]
18-
)
19-
]
5+
name: "HandySwift",
6+
products: [
7+
.library(name: "HandySwift", targets: ["HandySwift"])
8+
],
9+
targets: [
10+
.target(name: "HandySwift"),
11+
.testTarget(name: "HandySwiftTests", dependencies: ["HandySwift"])
12+
]
2013
)

README.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
alt="Coverage"/>
1414
</a>
1515
<a href="https://github.com/Flinesoft/HandySwift/releases">
16-
<img src="https://img.shields.io/badge/Version-3.3.0-blue.svg"
17-
alt="Version: 3.3.0">
16+
<img src="https://img.shields.io/badge/Version-3.4.0-blue.svg"
17+
alt="Version: 3.4.0">
1818
</a>
1919
<img src="https://img.shields.io/badge/Swift-5.1-FFAC45.svg" alt="Swift: 5.1">
2020
<img src="https://img.shields.io/badge/Platforms-iOS%20%7C%20tvOS%20%7C%20macOS%20%7C%20Linux-FF69B4.svg"
@@ -232,6 +232,28 @@ let unicodeString = "Hello composed unicode symbols! 👨‍👩‍👧‍👦
232232
unicodeString[unicodeString.fullRange] // => same string
233233
```
234234

235+
#### .encrypted(key:)
236+
237+
Encrypts this plain text `String` with the given key using AES.GCM and returns a base64 encoded representation of the encrypted data.
238+
`@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)`
239+
240+
``` Swift
241+
let key = SymmetricKey(size: .bits256)
242+
243+
let plainText = "Harry Potter is a 🧙"
244+
let encryptedString = try plainText.encrypted(key: key) // => "nz9LDkTNUEFj16Hrqvs4oCYeuIgV+nSP4OSqahkbtH62eJHHW664wC8NeFAMBPq7ZsY="
245+
```
246+
247+
#### .decrypted(key:)
248+
249+
Decrypts this base64 encoded representation of encrypted data with the given key using AES.GCM and returns the decrypted plain text `String`.
250+
`@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)`
251+
252+
``` Swift
253+
encryptedString.decrypt(key: key) // => "Harry Potter is a 🧙"
254+
```
255+
256+
235257
### NSRangeExtension
236258

237259
#### init(_:in:)
@@ -608,7 +630,7 @@ foo2.isEasy // => true
608630

609631
## Donation
610632

611-
BartyCrouch was brought to you by [Cihat Gündüz](https://github.com/Jeehut) in his free time. If you want to thank me and support the development of this project, please **make a small donation on [PayPal](https://paypal.me/Dschee/5EUR)**. In case you also like my other [open source contributions](https://github.com/Flinesoft) and [articles](https://medium.com/@Jeehut), please consider motivating me by **becoming a sponsor on [GitHub](https://github.com/sponsors/Jeehut)** or a **patron on [Patreon](https://www.patreon.com/Jeehut)**.
633+
HandySwift was brought to you by [Cihat Gündüz](https://github.com/Jeehut) in his free time. If you want to thank me and support the development of this project, please **make a small donation on [PayPal](https://paypal.me/Dschee/5EUR)**. In case you also like my other [open source contributions](https://github.com/Flinesoft) and [articles](https://medium.com/@Jeehut), please consider motivating me by **becoming a sponsor on [GitHub](https://github.com/sponsors/Jeehut)** or a **patron on [Patreon](https://www.patreon.com/Jeehut)**.
612634

613635
Thank you very much for any donation, it really helps out a lot! 💯
614636

0 commit comments

Comments
 (0)