'How to share a conanfile.py between my repository and ConanCenter?

I am currently developing a project which I would like to share via ConanCenter. I want to allow the user to optionally use Conan to install dependencies. I use CMake as the build system and find_package generator for Conan. If one wants to use packages built-in custom way or the system ones it is a perfectly viable option. This leaves me confused about where to store the conanfile.py file. On the one hand, it belongs to my local repository because of the dependencies that are stored there.

On the other hand, to share my package via ConanCenter, I have to store conanfile.py in a central repository. Keeping the same file in two separate repositories is a code smell. If it's unavoidable, I will do this, but maybe there is a better, more idiomatic way to handle this problem so that I have to manage only one conanfile.py or somewhat split the dependency and build information among the local repository and ConanCenter. Is there any solution to such a situation?



Solution 1:[1]

You can use @Binding property wrapper to create a 2 way connection, this way both views have access to it and both can modify it. Here is your modified code.

struct AssignValuesToOtherStruct: View {

    @State private var rectangleIsShown = true

    var body: some View {
        if rectangleIsShown {
          BlueRectangle(rectangleIsShown: $rectangleIsShown)
        }
    }
}

struct BlueRectangle: View {

  @Binding var rectangleIsShown: Bool

    var body: some View {
        VStack {
            Button(action: {rectangleIsShown = false}) {
                Text("hide Rectangle")
            }
            Rectangle()
                .fill(.blue)
                .frame(width: 100, height: 100)
        }
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 njdeane