Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
23deb1c
Update swift-tools and new platform visionos
BProg Jan 15, 2024
e5bb888
adds privacy manifest
maxim-chipeev Mar 26, 2024
c27531b
Merge pull request #550 from Swinject/maxim/add-privacy-manifest
maxim-chipeev Mar 28, 2024
58061a1
Merge pull request #544 from BProg/visionos
maxim-chipeev Mar 28, 2024
0074a21
Undo graph restoration once Lazy wrapper resolves its local hierarchy
maxim-chipeev Apr 4, 2024
6c5ba3b
Merge pull request #551 from Swinject/maxim/graph-stack
maxim-chipeev Apr 5, 2024
65f9153
update version and Faire ownership
maxim-chipeev Apr 5, 2024
13d2d70
Merge pull request #552 from Swinject/maxim/version-285
yoichitgy Apr 6, 2024
c6da4f9
Correct the xcodeproj manifest
maxim-chipeev Apr 9, 2024
0b0fa30
Fix Carthage build
maxim-chipeev Apr 9, 2024
4da509c
Added Privacy manifest in resource bundles
Apr 10, 2024
b53aaf1
Merge pull request #554 from visaev/privacy_manifest_cocoapods
maxim-chipeev Apr 12, 2024
d813d23
Add privacy manifest to Xcodeproj
maxim-chipeev Apr 12, 2024
b45ac37
update to 2.8.6
maxim-chipeev Apr 12, 2024
df54e4b
Fix Privacy manifest
Apr 17, 2024
c7920e1
Merge pull request #555 from gre7if/fix/privacy_manifest
maxim-chipeev Apr 22, 2024
b937d8f
update version 2.8.7
maxim-chipeev Apr 22, 2024
cb81e95
fixes for sync performance
maxim-chipeev Apr 26, 2024
daec396
SPM asks for PrivacyManifest to be in Sources
maxim-chipeev Apr 29, 2024
5e24dc7
Perform graph resolution completion only on relevant services
maxim-chipeev Apr 29, 2024
63c9692
Merge pull request #557 from Swinject/maxim/spm-detect-manifest
maxim-chipeev Apr 29, 2024
c32e0ee
Merge pull request #556 from Swinject/maxim/sync-performance
maxim-chipeev Apr 29, 2024
cfef384
Merge pull request #558 from Swinject/maxim/optimize-graph-resolution…
maxim-chipeev Apr 29, 2024
736da60
update to version 2.8.8
maxim-chipeev Apr 29, 2024
bd72839
Merge pull request #559 from Swinject/2.8.8
maxim-chipeev Apr 29, 2024
1ed342b
fix cocoa-release
maxim-chipeev Apr 29, 2024
3125943
Lock should be internal
maxim-chipeev Apr 30, 2024
66e5a09
Fix SPM Github Workflow
bradfol May 8, 2024
1eb9e23
Fix pod lint workflow
bradfol May 8, 2024
9785397
Fix visionOS build error in recursiveLock
s0ta91 May 15, 2024
4bce92a
Merge pull request #561 from bradfol/bradfol/fixup-githubworkflow
maxim-chipeev May 16, 2024
284579a
Fix the links to Funq and its author. The links were broken as CodePl…
yoichitgy May 19, 2024
487f016
Merge pull request #565 from yoichitgy/fix-links-to-funq
yoichitgy May 27, 2024
6f8bcfe
Fix up test assertions
bradfol May 8, 2024
cee9ee8
Expose object graph
maxim-chipeev May 31, 2024
86ba38d
version update
maxim-chipeev May 31, 2024
5c9d668
address PR comments
maxim-chipeev May 31, 2024
e58ff8f
Merge pull request #564 from s0ta91/fix/visionOS-build-error
maxim-chipeev May 31, 2024
ab5da06
Merge pull request #562 from bradfol/bradfol/test-warnings
maxim-chipeev May 31, 2024
0ee26f4
Merge pull request #568 from Swinject/maxim/expose-graph
maxim-chipeev May 31, 2024
2da70d8
visionOS addition
maxim-chipeev May 31, 2024
c630fca
resolve
maxim-chipeev Jun 3, 2024
f8148d6
update version to 2.9.1
maxim-chipeev Jun 3, 2024
be9dbcc
Merge pull request #569 from Swinject/maxim/resolve-depth
maxim-chipeev Jun 3, 2024
e2fcd40
Update Github Runners to macos 15.5 and Xcode 16.4 (#585)
0xLucasMarcal Aug 16, 2025
d5add67
Delete Swinject Dynamic target (#583)
0xLucasMarcal Aug 16, 2025
91ac1af
Enable Swift 6 language mode (#582)
0xLucasMarcal Aug 16, 2025
85a8dca
Allow access to ServiceEntry properties (#575)
bradfol Aug 16, 2025
abfff6a
feat(container): add resetObjectScope(_:serviceType:) for finer cache…
mehdisam Aug 17, 2025
ea9bffe
add missing property to ThreadSafeDictionary
0xLucasMarcal Aug 23, 2025
b685b54
Update the version to 2.10.0
0xLucasMarcal Sep 1, 2025
ae75d4e
Merge branch 'master' of github.com:Swinject/Swinject into Swinject-m…
LevinIvan Dec 4, 2025
d0316d1
Fix problem with Container
LevinIvan Dec 4, 2025
9fda7eb
Revert container logic
LevinIvan Dec 5, 2025
72665f6
Removed unused code
LevinIvan Dec 5, 2025
3a4db9f
Fix tests
LevinIvan Dec 5, 2025
c69e0c1
Fix tests in ContainerTests
LevinIvan Dec 5, 2025
0728094
Fix test with weak inObjectScope
LevinIvan Dec 5, 2025
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
27 changes: 0 additions & 27 deletions .Package.Test.swift

This file was deleted.

24 changes: 15 additions & 9 deletions .github/workflows/Pod Lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@

name: Pod Lint
on:
workflow_dispatch:
env:
ENCODING: LC_CTYPE=en_US.UTF-8
DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
pod-lint:
runs-on: macos-10.15
runs-on: macos-15
env:
ENCODING: LC_CTYPE=en_US.UTF-8
DEVELOPER_DIR: /Applications/Xcode_16.4.app/Contents/Developer
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Linting PodSpec for Cocoapods"
run: export "${{ env. ENCODING }}" | pod lib lint
shell: bash
uses: actions/checkout@v4
- name: Inspect Environment
run: xcrun simctl list
shell: bash
- name: Linting PodSpec for Cocoapods
run: export "${{ env. ENCODING }}" | pod lib lint --verbose
shell: bash
12 changes: 6 additions & 6 deletions .github/workflows/Project Testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,33 @@ on:
workflow_dispatch:
env:
PROJECT: Swinject.xcodeproj
DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_16.4.app/Contents/Developer
jobs:
test:
runs-on: macos-10.15
runs-on: macos-15
strategy:
matrix:
include:
- platform-version: iOS
DEST: "OS=14.4,name=iPhone 8"
DEST: "OS=18.4,name=iPhone 16"
SCHEME: "Swinject-iOS"
SDK: "iphonesimulator"
ACTION: "test"
PLATFORM: "iOS"
- platform-version: macOS
DEST: "arch=x86_64"
DEST: "arch=arm64"
SCHEME: "Swinject-macOS"
SDK: "macosx"
ACTION: "test"
PLATFORM: "OSX"
- platform-version: tvOS
DEST: "OS=14.3,name=Apple TV 4K"
DEST: "OS=18.4,name=Apple TV 4K"
SCHEME: "Swinject-tvOS"
SDK: "appletvsimulator"
ACTION: "test"
PLATFORM: "tvOS"
- platform-version: watchOS
DEST: "OS=7.2,name=Apple Watch Series 6 - 44mm"
DEST: "OS=11.4,name=Apple Watch Series 10 - 46mm"
SCHEME: "Swinject-watchOS"
SDK: "watchsimulator"
ACTION: "build"
Expand Down
20 changes: 13 additions & 7 deletions .github/workflows/SPM Testing.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
# This is the First Workflow for Testing with Github Actions

name: SPM Check

on:
workflow_dispatch:
env:
DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
spm-check:
runs-on: macos-10.15
env:
DEVELOPER_DIR: /Applications/Xcode_16.4.app/Contents/Developer
runs-on: macos-15
steps:
- uses: actions/checkout@v2
- name: Setup Package File
run: mv .Package.Test.swift Package.swift
- uses: actions/checkout@v4
- uses: swift-actions/setup-swift@v2
with:
swift-version: "6.0.3"
- name: Build
run: swift build -v
- name: Run tests
Expand Down
2 changes: 1 addition & 1 deletion .swiftformat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--swiftversion 5.0
--swiftversion 6.0
--exclude .Package.Test.swift
--exclude Package.swift
--header "\n Copyright © {created.year} Swinject Contributors. All rights reserved.\n"
54 changes: 0 additions & 54 deletions .travis.yml

This file was deleted.

14 changes: 6 additions & 8 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
// swift-tools-version:5.0
// swift-tools-version:6.0.0

import PackageDescription

let package = Package(
name: "Swinject",
platforms: [
.macOS(.v10_10),
.iOS(.v9),
.tvOS(.v9),
.watchOS(.v2)
.macOS(.v10_13),
.iOS(.v12),
.tvOS(.v12),
.watchOS(.v4),
.visionOS(.v1)
],
products: [
.library(name: "Swinject",
targets: ["Swinject"]),
.library(name: "Swinject-Dynamic",
type: .dynamic,
targets: ["Swinject"]),
],
targets: [
.target(name: "Swinject",
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
Swinject
========

[![Travis CI Com](https://travis-ci.com/Swinject/Swinject.svg?branch=master)](https://travis-ci.com/Swinject/Swinject)
![Github Actions](https://github.com/1ucas/Swinject/actions/workflows/Project%20Testing.yml/badge.svg?branch=master)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![CocoaPods Version](https://img.shields.io/cocoapods/v/Swinject.svg?style=flat)](http://cocoapods.org/pods/Swinject)
Expand All @@ -18,6 +17,8 @@ Swinject is a lightweight [dependency injection](https://en.wikipedia.org/wiki/D

Dependency injection (DI) is a software design pattern that implements Inversion of Control (IoC) for resolving dependencies. In the pattern, Swinject helps your app split into loosely-coupled components, which can be developed, tested and maintained more easily. Swinject is powered by the Swift generic type system and first class functions to define dependencies of your app simply and fluently.

Swinject is maintained by the [Faire Wholesale Inc.](https://github.com/Faire?view_as=public) mobile platform team.

## Features

- [x] [Pure Swift Type Support](./Documentation/README.md#user-content-pure-swift-type-support)
Expand Down Expand Up @@ -280,7 +281,7 @@ The DI container features of Swinject are inspired by:

and highly inspired by:

- [Funq](http://funq.codeplex.com) - [Daniel Cazzulino](http://www.codeplex.com/site/users/view/dcazzulino) and [the project team](http://funq.codeplex.com/team/view).
- [Funq](https://github.com/kzu/funq) - [Daniel Cazzulino](https://github.com/kzu).

## License

Expand Down
5 changes: 3 additions & 2 deletions Sources/Behavior.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
/// Protocol for adding functionality to the container
public protocol Behavior {
/// This will be invoked on each behavior added to the `container` for each `entry` added to the container using
/// one of the `register()` or type forwading methods
/// one of the `register()` or type forwarding methods
///
/// - Parameters:
/// - container: container into which an `entry` has been registered
/// - type: Type which will be resolved using the `entry`
/// - entry: ServiceEntry registered to the `container`
/// - name: name under which the service has been registered to the `container`
///
/// - Remark: `Type` and `Service` can be different types in the case of type forwarding
/// - Remark: `Type` and `Service` can be different types in the case of type forwarding (commonly used as `.implements()`).
/// `Type` will represent the forwarded type key, and `Service` will represent the destination.
func container<Type, Service>(
_ container: Container,
didRegisterType type: Type.Type,
Expand Down
2 changes: 1 addition & 1 deletion Sources/Container.Arguments.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import Foundation

// MARK: - Registeration with Arguments
// MARK: - Registration with Arguments
extension Container {
<% (1..arg_count).each do |i| %>
<% arg_types = (1..i).map { |n| "Arg#{n}" }.join(", ") %>
Expand Down
2 changes: 1 addition & 1 deletion Sources/Container.Arguments.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import Foundation

// MARK: - Registeration with Arguments
// MARK: - Registration with Arguments

extension Container {
/// Adds a registration for the specified service with the factory closure to specify how the service is resolved with dependencies.
Expand Down
16 changes: 4 additions & 12 deletions Sources/Container.Logging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,11 @@
// Copyright © 2019 Swinject Contributors. All rights reserved.
//

public typealias LoggingFunctionType = (String) -> Void

import Foundation
public extension Container {
/// Function to be used for logging debugging data.
/// Default implementation writes to standard output.
static var loggingFunction: LoggingFunctionType? {
get { return _loggingFunction }
set { _loggingFunction = newValue }
}

internal static func log(_ message: String) {
_loggingFunction?(message)
if ProcessInfo.processInfo.environment["SWINJECT_LOGGING_ENABLED"] == "1" {
print(message)
}
}
}

private var _loggingFunction: LoggingFunctionType? = { print($0) }
6 changes: 4 additions & 2 deletions Sources/Container.TypeForwarding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ extension Container {
name: name,
option: nil
)
services[key] = service
behaviors.forEach { $0.container(self, didRegisterType: type, toService: service, withName: name) }
syncIfEnabled {
services[key] = service
behaviors.forEach { $0.container(self, didRegisterType: type, toService: service, withName: name) }
}
}
}
Loading