Skip to content
Open
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
12 changes: 2 additions & 10 deletions Sources/NeedleFoundation/Component.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,7 @@ open class Component<DependencyType>: Scope {

private let sharedInstanceLock = NSRecursiveLock()
private var sharedInstances = [String: Any]()
private lazy var name: String = {
let fullyQualifiedSelfName = String(describing: self)
let parts = fullyQualifiedSelfName.components(separatedBy: ".")
return parts.last ?? fullyQualifiedSelfName
}()
private lazy var name: String = _typeName(type(of: self), qualified: false)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wonderful, but it uses a private API. Up to the maintainers to decide if that's ok

Copy link
Author

@ChrisBenua ChrisBenua Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not truly private API. This function is public but not documented.

Moreover, it can be accessed indirectly by calling regular string interpolation. Like "\(type(of: self))"


// TODO: Replace this with an `open` method, once Swift supports extension
// overriding methods.
Expand Down Expand Up @@ -270,11 +266,7 @@ open class Component<DependencyType>: Scope {

private let sharedInstanceLock = NSRecursiveLock()
private var sharedInstances = [String: Any]()
private lazy var name: String = {
let fullyQualifiedSelfName = String(describing: self)
let parts = fullyQualifiedSelfName.components(separatedBy: ".")
return parts.last ?? fullyQualifiedSelfName
}()
private lazy var name: String = _typeName(type(of: self), qualified: false)

// TODO: Replace this with an `open` method, once Swift supports extension
// overriding methods.
Expand Down