Posts

Post not yet marked as solved
1 Replies
2.0k Views
Sadly, I was not able to register for the Games Q&A at. WWDC. My question is as follows: For making a Universal Binary, one compatible with Big Sur and up, will the tools in Xcode 15 help me port over a Win32 project over, or does the tool only work assuming macOS Sonoma and up, exclusively on Apple Silicon?
Posted
by pi1024e.
Last updated
.
Post marked as solved
1 Replies
498 Views
The sliders themselves are rendered, but not the text no matter what I try. Here is my code for reference: var body: some View { ScrollView { Text("Synth View") .font(.system(size: 55, weight: .semibold, design: .rounded)) .padding(.bottom) VStack { Button( "Trumpet", action: { modulatingMultiplier = 10 frequency = 200 carrierMod = 5 index = 440 amplitude = 10 } ) LineGraph(data: data, maxData: maxData, minValue: graphMinValue, maxValue: graphMaxValue) .clipped() .background(Color.accentColor.opacity(0.1)) .cornerRadius(20) .padding() .aspectRatio(1, contentMode: .fit) VStack { Slider(value: $frequency, in: 0...20000) { Text("Frequency").padding(.horizontal) } Slider(value: $modulatingMultiplier, in: 0...1000) { Text("Modulating Multiplier").padding(.horizontal) } Slider(value: $carrierMod, in: 0...1000) { Text("Carrier Mod").padding(.horizontal) } Slider(value: $amplitude, in: 0...1000) { Text("Amplitude").padding(.horizontal) } Slider(value: $index, in: 0...1000) { Text("Modulation Index").padding(.horizontal) } }.padding(.horizontal).frame(width: 600) } .onAppear { detector.onUpdate = { data.append(Double(detector.pitch) * 0.01) detector.setFrequency(Frequency : frequency, modulatingMultiplier : modulatingMultiplier, Amplitude: amplitude, cMult : carrierMod, index : index) } } } }
Posted
by pi1024e.
Last updated
.
Post not yet marked as solved
2 Replies
985 Views
When I have a property like this: @property (nonatomic, readonly, copy) NSURL *sourceURL; And then I call: NSURL *url = self.sourceURL; Assuming that ARC is disabled, to ensure this object does not leak, must I manually release url? If so, how come I don't have to with: NSURL *url = [NSURL URLWithString:@"http://www.apple.com"]; NSURL *absURL = url.absoluteURL; Despite the absoluteString property also being readonly and copy: As per Apple: @property(nullable, readonly, copy) NSURL *absoluteURL;
Posted
by pi1024e.
Last updated
.
Post not yet marked as solved
2 Replies
501 Views
I heard that "Methods starting with init or new or containing copy transfer, by definition, ownership; all other methods do not. Does this apply to ALL methods with the word "init" in the name, even if the function is "initialCapitalizationMode", in which initial does not mean the same as init? Or does it only work if it has "init" and then an uppercase letter after the fact?
Posted
by pi1024e.
Last updated
.
Post marked as solved
3 Replies
550 Views
Assume this code is compiled under ARC: BOOL method(unsigned a) { NSString *string = [[NSString alloc] initWithCString:"hi"]; if (a & 1 == 1) { CFStringRef CF = (CFStringRef)CFBridgingRetain(string); printf("%s", CFStringGetCStringPtr(CF, kCFStringEncodingUTF8)); CFRelease(CF); } } Will string get over-released in this example? What if I did the reverse? BOOL method(unsigned a) { CFStringRef string = CFStringCreateWithCString(NULL, "Hello World!", kCFStringEncodingUTF8); if (a & 1 == 1) { NSString *ns = (NSString *)CFBridgingRelease(string); printf("%s", CFStringGetCStringPtr(CF, kCFStringEncodingUTF8); } if (string) CFRelease(string); }
Posted
by pi1024e.
Last updated
.
Post not yet marked as solved
1 Replies
942 Views
The restrict keyword is rarely used in c applications and frameworks. Can clang automatically detect pointers that are mutually exclusive and optimize according to such or is the keyword needed for such optimizations? Finally does macos and iOS have their functions in C optimized like this as well?
Posted
by pi1024e.
Last updated
.
Post marked as solved
3 Replies
2.2k Views
I understand there are many differences between Mac and iOS, but with Macs getting native iOS app support and the two platforms being similar more than ever, I wonder if it is possible to make a singular SwiftUI and then compile it for both, or must I still make a new one for each?
Posted
by pi1024e.
Last updated
.