Post

Replies

Boosts

Views

Activity

Reply to Xcode: Could not attach to pid
I have this problem ONLY when debugging Photo Extensions and ONLY since upgrading to Ventura. Of course I tried all suggestions here: Developer Mode enabled ➔ Of Course as I can debug everything except Photo Extension Debug Executable is off, Command Line Tools are set correctly etc. as the only variable was the upgrade from Monterey to Ventura. I have tried everything I could find on the topic, so I am very grateful for any suggestions!! All the best Christoph
Topic: App & System Services SubTopic: Core OS Tags:
Nov ’22
Reply to ScrollView shrink to fit
Just quickly here is the code how I finally used it. It is based @joosttk approach, but using preference to be changed at any time. Also I added a stroke so it is obvious why the ScrollView should shrink, too. struct HeightPreferenceKey: PreferenceKey { typealias Value = CGFloat static var defaultValue: CGFloat = 40 static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) { value = nextValue() } } struct FittedScrollView: View { static func newString() -> String { String(repeating: "Hello World! ", count: Int.random(in: 1..<35)) } @State private var contentString = Self.newString() @State private var contentHeight: CGFloat = 40 var body: some View { VStack { ScrollView { Text(contentString) .padding(20) .overlay( GeometryReader { geo in Color.clear.preference(key: HeightPreferenceKey.self, value: geo.size.height) }) } .frame(maxWidth: 300, maxHeight: contentHeight, alignment: .center) .padding(20) .background(RoundedRectangle(cornerRadius: 20).stroke(Color(white: 0.4), lineWidth: 3)) .background(RoundedRectangle(cornerRadius: 20).fill(Color(white: 0.8))) Button("Next Text", action: { contentString = Self.newString() }) } .frame(height: 300) .onPreferenceChange(HeightPreferenceKey.self) { contentHeight = $0 } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’21