-{"primaryContentSections":[{"kind":"declarations","declarations":[{"tokens":[{"text":"protocol","kind":"keyword"},{"kind":"text","text":" "},{"text":"AutoRegistering","kind":"identifier"}],"platforms":["macOS"],"languages":["swift"]}]},{"kind":"content","content":[{"level":2,"anchor":"overview","text":"Overview","type":"heading"},{"inlineContent":[{"type":"text","text":"Add this protocol to a container to support first-time registration of needed dependencies prior to first resolution"},{"type":"text","text":" "},{"type":"text","text":"of a dependency on that container."}],"type":"paragraph"},{"code":["extension Container: @retroactive AutoRegistering {"," func autoRegister() {"," someService.register {"," CrossModuleService()"," }"," }","}"],"syntax":"swift","type":"codeListing"},{"inlineContent":[{"type":"text","text":"The "},{"type":"codeVoice","code":"autoRegister"},{"type":"text","text":" function is called on each instantiated container prior to"},{"type":"text","text":" "},{"type":"text","text":"the first resolution of a Factory on that container."}],"type":"paragraph"},{"content":[{"type":"paragraph","inlineContent":[{"type":"text","text":"Calling "},{"code":"container.manager.reset(options: .all)","type":"codeVoice"},{"type":"text","text":" restores the container to it’s initial state"},{"text":" ","type":"text"},{"text":"and autoRegister will be called again if it exists.","type":"text"}]}],"type":"aside","name":"Warning","style":"warning"},{"type":"paragraph","inlineContent":[{"type":"text","text":"The "},{"code":"@retroactive","type":"codeVoice"},{"type":"text","text":" attribute is needed as of Swift 6 to silence a conformance warning."}]}]}],"metadata":{"externalID":"s:7Factory15AutoRegisteringP","fragments":[{"text":"protocol","kind":"keyword"},{"kind":"text","text":" "},{"text":"AutoRegistering","kind":"identifier"}],"roleHeading":"Protocol","role":"symbol","navigatorTitle":[{"kind":"identifier","text":"AutoRegistering"}],"title":"AutoRegistering","modules":[{"name":"Factory"}],"symbolKind":"protocol"},"variants":[{"paths":["\/documentation\/factory\/autoregistering"],"traits":[{"interfaceLanguage":"swift"}]}],"kind":"symbol","hierarchy":{"paths":[["doc:\/\/Factory\/documentation\/Factory"]]},"abstract":[{"type":"text","text":"Adds an registration “hook” to a "},{"code":"Container","type":"codeVoice"},{"type":"text","text":"."}],"identifier":{"interfaceLanguage":"swift","url":"doc:\/\/Factory\/documentation\/Factory\/AutoRegistering"},"sections":[],"topicSections":[{"generated":true,"anchor":"Instance-Methods","identifiers":["doc:\/\/Factory\/documentation\/Factory\/AutoRegistering\/autoRegister()"],"title":"Instance Methods"}],"schemaVersion":{"minor":3,"patch":0,"major":0},"references":{"doc://Factory/documentation/Factory":{"abstract":[{"type":"text","text":"A new approach to Container-Based Dependency Injection for Swift and SwiftUI."}],"kind":"symbol","title":"Factory","role":"collection","type":"topic","identifier":"doc:\/\/Factory\/documentation\/Factory","url":"\/documentation\/factory"},"doc://Factory/documentation/Factory/AutoRegistering/autoRegister()":{"identifier":"doc:\/\/Factory\/documentation\/Factory\/AutoRegistering\/autoRegister()","url":"\/documentation\/factory\/autoregistering\/autoregister()","kind":"symbol","fragments":[{"text":"func","kind":"keyword"},{"text":" ","kind":"text"},{"kind":"identifier","text":"autoRegister"},{"kind":"text","text":"()"}],"type":"topic","abstract":[{"type":"text","text":"User provided function that supports first-time registration of needed dependencies prior to first resolution"},{"text":" ","type":"text"},{"type":"text","text":"of a dependency on that container."}],"role":"symbol","required":true,"title":"autoRegister()"},"doc://Factory/documentation/Factory/AutoRegistering":{"title":"AutoRegistering","type":"topic","role":"symbol","navigatorTitle":[{"text":"AutoRegistering","kind":"identifier"}],"abstract":[{"text":"Adds an registration “hook” to a ","type":"text"},{"code":"Container","type":"codeVoice"},{"text":".","type":"text"}],"fragments":[{"kind":"keyword","text":"protocol"},{"kind":"text","text":" "},{"text":"AutoRegistering","kind":"identifier"}],"url":"\/documentation\/factory\/autoregistering","identifier":"doc:\/\/Factory\/documentation\/Factory\/AutoRegistering","kind":"symbol"}}}
0 commit comments