---
title: "Discussion on \"Automatically run Swift code when your framework gets initialized\" | Hashnode"
description: "Discussion on \"Automatically run Swift code when your framework gets initialized\". Implement the load function for an Objective-C class and then delegate to Swit code and that code gets automatically called during framework initialization."
url: "https://hashnode.com/posts/automatically-run-swift-code-when-your-framework-gets-initialized/63d8a05f17b32e37db256704"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Automatically run Swift code when your framework gets initialized](https://blog.eidinger.info/automatically-run-swift-code-when-your-framework-gets-initialized?utm_source=hashnode&utm_medium=feed)

Implement the load function for an Objective-C class and then delegate to Swit code and that code gets automatically called during framework initialization.

Jan 31, 2023 · 2 min read · blog.eidinger.info  
Read the article

-   [#swift](https://hashnode.com/tag/swift)
-   [#objective-c](https://hashnode.com/tag/objective-c)
-   [#ios](https://hashnode.com/tag/ios)

## Written by

[Marco Eidinger](https://hashnode.com/@MarcoEidinger)

@MarcoEidinger

  
[View profile](https://hashnode.com/@MarcoEidinger)

#Swift #iOS SDK architect 🇺🇸 🇩🇪

I am a Software Engineer working on open source and enterprise mobile SDKs for iOS and MacOS developers written in Swift. From 🇩🇪 and happily living in 🇺🇸

## Responses 1

Markdown supported · ⌘↵ to post

[Stijn Willems](https://hashnode.com/@dooZMen)

[Mar 19, 2024](https://hashnode.com/posts/automatically-run-swift-code-when-your-framework-gets-initialized/63d8a05f17b32e37db256704/comment/65f97bdc8f7cb02750dff347)

Did you ever find a was to do a this with a swift package library? You cannot have mixed targets there. I'm thinking of using this [github.com/bscothern/Once](https://github.com/bscothern/Once) with some other still to define way of working. Do you have a recommended approach?
