AliSoftware / Dip

Simple Swift Dependency container. Use protocols to resolve your dependencies and avoid singletons / sharedInstances!
MIT License
978 stars 75 forks source link

Xcode 10.2 Crash #220

Closed ccarranzaD3 closed 5 years ago

ccarranzaD3 commented 5 years ago

The library seems to be crashing at runtime in Xcode 10.2. I made sure the pod is building with swift 4.2 as its swift version but this particular line seems to be causing the issue in AutoInjection.swift line 47.

private func resolveChild(child: Mirror.Child) throws {
    //HOTFIX for https://bugs.swift.org/browse/SR-2282
    guard !String(describing: type(of: child.value)).has(prefix: "ImplicitlyUnwrappedOptional") else { return }
    ...
  }

If I comment out that line, it runs just fine. I could make a PR and wrap it in a swift version check, but as I said I'm have it set as a swift 4.2 pod which it is. Any help would be appreciated.

ilyapuchka commented 5 years ago

You can disable auto injection by setting autoInjectProperties tofalse when creating container, so this code that causes a crash for you won't be called.

Oni-zerone commented 5 years ago

Thanks, this saved my day!