Skip to content

Remove Objective-C support #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jun 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3.5'
ruby-version: '3.4.3'
bundler-cache: true
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
Expand All @@ -26,7 +26,7 @@ jobs:
sudo xcodebuild -downloadPlatform visionOS
sudo xcodebuild -runFirstLaunch
- name: Lint Podspec
run: bundle exec pod lib lint --verbose --fail-fast --swift-version=6.0 --allow-warnings # Cocoapods v1.6 now warns about potential naming colisions. We can fix this in the next breaking change.
run: bundle exec pod lib lint --verbose --fail-fast --swift-version=6.0 --allow-warnings # Cocoapods v1.6 now warns about potential naming colisions.
spm-16:
name: Build Xcode 16
runs-on: macOS-15
Expand All @@ -44,7 +44,7 @@ jobs:
uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3.5'
ruby-version: '3.4.3'
bundler-cache: true
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
Expand All @@ -70,7 +70,7 @@ jobs:
uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3.5'
ruby-version: '3.4.3'
bundler-cache: true
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.5
3.4.3
4 changes: 2 additions & 2 deletions CLI/Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions CacheAdvance.podspec
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Pod::Spec.new do |s|
s.name = 'CacheAdvance'
s.version = '3.1.0'
s.version = '4.0.0'
s.license = 'Apache License, Version 2.0'
s.summary = 'A performant cache for logging systems. CacheAdvance persists log events 30x faster than SQLite.'
s.homepage = 'https://github.com/dfed/CacheAdvance'
s.authors = 'Dan Federman'
s.source = { :git => 'https://github.com/dfed/CacheAdvance.git', :tag => s.version }
s.source_files = 'Sources/**/*.{swift}', 'Sources/**/*.{h,m}'
s.ios.deployment_target = '13.0'
s.tvos.deployment_target = '13.0'
s.watchos.deployment_target = '6.0'
s.macos.deployment_target = '10.15'
s.source_files = 'Sources/**/*.{swift}'
s.ios.deployment_target = '15.0'
s.tvos.deployment_target = '15.0'
s.watchos.deployment_target = '7.0'
s.macos.deployment_target = '11'
s.visionos.deployment_target = '1.0'
end
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ruby '3.3.5'
ruby '3.4.3'

source 'https://rubygems.org'

Expand Down
44 changes: 24 additions & 20 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ GEM
base64
nkf
rexml
activesupport (7.2.1.2)
activesupport (7.2.2.1)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
Expand All @@ -22,13 +23,14 @@ GEM
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
base64 (0.2.0)
bigdecimal (3.1.8)
base64 (0.3.0)
benchmark (0.4.1)
bigdecimal (3.2.2)
claide (1.1.0)
cocoapods (1.16.1)
cocoapods (1.16.2)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.16.1)
cocoapods-core (= 1.16.2)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 2.1, < 3.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
Expand All @@ -42,8 +44,8 @@ GEM
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.26.0, < 2.0)
cocoapods-core (1.16.1)
xcodeproj (>= 1.27.0, < 2.0)
cocoapods-core (1.16.2)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
Expand All @@ -63,36 +65,38 @@ GEM
netrc (~> 0.11)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
drb (2.2.1)
concurrent-ruby (1.3.5)
connection_pool (2.5.3)
drb (2.2.3)
escape (0.0.4)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.17.0)
ffi (1.17.2)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.14.6)
httpclient (2.9.0)
mutex_m
i18n (1.14.7)
concurrent-ruby (~> 1.0)
json (2.7.5)
logger (1.6.1)
minitest (5.25.1)
json (2.12.2)
logger (1.7.0)
minitest (5.25.5)
molinillo (0.8.0)
mutex_m (0.3.0)
nanaimo (0.4.0)
nap (1.1.0)
netrc (0.11.0)
nkf (0.2.0)
public_suffix (4.0.7)
rexml (3.3.9)
rexml (3.4.1)
ruby-macho (2.5.1)
securerandom (0.3.1)
securerandom (0.4.1)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
xcodeproj (1.26.0)
xcodeproj (1.27.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
Expand All @@ -107,7 +111,7 @@ DEPENDENCIES
cocoapods (~> 1.16.0)

RUBY VERSION
ruby 3.3.5p94
ruby 3.4.3p32

BUNDLED WITH
2.5.16
54 changes: 7 additions & 47 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,71 +6,31 @@ import PackageDescription
let package = Package(
name: "CacheAdvance",
platforms: [
.iOS(.v13),
.tvOS(.v13),
.watchOS(.v6),
.macOS(.v10_15),
.macCatalyst(.v13),
.iOS(.v15),
.tvOS(.v15),
.watchOS(.v7),
.macOS(.v11),
.macCatalyst(.v15),
],
products: [
.library(
name: "CacheAdvance",
targets: ["CacheAdvance"]
),
.library(
name: "CADCacheAdvance",
targets: ["CADCacheAdvance"]
),
].filter {
#if os(Linux)
$0.name != "CADCacheAdvance"
#else
true
#endif
},
],
targets: [
.target(
name: "CacheAdvance",
swiftSettings: [
.swiftLanguageMode(.v6),
.define("SWIFT_PACKAGE_MANAGER"),
]
),
.testTarget(
name: "CacheAdvanceTests",
dependencies: ["CacheAdvance", "LorumIpsum"],
swiftSettings: [
.swiftLanguageMode(.v6),
]
),
.target(
name: "CADCacheAdvance",
dependencies: ["CacheAdvance"],
swiftSettings: [
.swiftLanguageMode(.v6),
.define("SWIFT_PACKAGE_MANAGER"),
]
),
.target(
name: "LorumIpsum",
dependencies: [],
swiftSettings: [
.swiftLanguageMode(.v6),
]
),
.testTarget(
name: "CADCacheAdvanceTests",
dependencies: ["CADCacheAdvance", "LorumIpsum"],
swiftSettings: [
.swiftLanguageMode(.v6),
]
),
].filter {
#if os(Linux)
$0.name != "CADCacheAdvance"
&& $0.name != "CADCacheAdvanceTests"
#else
true
#endif
}
]
)
21 changes: 3 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ let myCache = try CacheAdvance<MyMessageType>(
shouldOverwriteOldMessages: false)
```

```objc
CADCacheAdvance *const cache = [[CADCacheAdvance alloc]
initWithFileURL:[NSFileManager.defaultManager.temporaryDirectory URLByAppendingPathComponent:@"MyCache"]
maximumBytes:5000
shouldOverwriteOldMessages:YES
error:nil];
```
To begin caching messages, you need to create a CacheAdvance instance with:

* A file URL – this URL must represent a file that has already been created. You can create a file by using `FileManager`'s [createFile(atPath:contents:attributes:)](https://developer.apple.com/documentation/foundation/filemanager/1410695-createfile) API.
Expand All @@ -38,10 +31,6 @@ To begin caching messages, you need to create a CacheAdvance instance with:
try myCache.append(message: someMessage)
```

```objc
[cache appendMessage:someData error:nil];
```

By the time the above method exits, the message will have been persisted to disk. A CacheAdvance keeps no in-memory buffer. Appending a new message is cheap, as a CacheAdvance needs to encode and persist only the new message and associated metadata.

A CacheAdvance instance that does not overwrite old messages will throw a `CacheAdvanceError.messageDataTooLarge` if appending a message would exceed the cache's `maximumBytes`. A CacheAdvance instance that does overwrite old messages will throw a `CacheAdvanceError.messageDataTooLarge` if the message would require more than `maximumBytes` to store even after evicting all older messages from the cache.
Expand All @@ -54,10 +43,6 @@ To ensure that caches can be read from 32bit devices, messages should not be lar
let cachedMessages = try myCache.messages()
```

```objc
NSArray<NSData> *const cachedMessages = [cache messagesAndReturnError:nil];
```

This method reads all cached messages from disk into memory.

### Thread safety
Expand All @@ -83,7 +68,7 @@ The first 64bytes of a CacheAdvance is reserved for storing metadata about the f
* tvOS 13 or later.
* watchOS 6 or later.
* macOS 10.15 or later.
* Swift 5.10 or later.
* Swift 6.0 or later.

## Installation

Expand All @@ -93,7 +78,7 @@ To install CacheAdvance in your project with [Swift Package Manager](https://git

```swift
dependencies: [
.package(url: "https://github.com/dfed/CacheAdvance", from: "3.0.0"),
.package(url: "https://github.com/dfed/CacheAdvance", from: "4.0.0"),
]
```

Expand All @@ -102,7 +87,7 @@ dependencies: [
To install CacheAdvance in your project with [CocoaPods](https://blog.cocoapods.org/CocoaPods-Specs-Repo), add the following to your `Podfile`:

```
pod 'CacheAdvance', '~> 3.0'
pod 'CacheAdvance', '~> 4.0'
```

## Contributing
Expand Down
2 changes: 1 addition & 1 deletion Scripts/build.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ for rawPlatform in rawPlatforms {
}

var xcodeBuildArguments = [
"-scheme", "CacheAdvance-Package",
"-scheme", "CacheAdvance",
"-sdk", platform.sdk,
"-derivedDataPath", platform.derivedDataPath,
"-PBXBuildsContinueAfterErrors=0",
Expand Down
1 change: 0 additions & 1 deletion Scripts/prepare-coverage-reports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ for directory in $(git rev-parse --show-toplevel)/.build/derivedData/*/; do
echo "Finding coverage information for $build_type"

exportlcov $build_type 'CacheAdvanceTests'
exportlcov $build_type 'CADCacheAdvanceTests'
done
Loading