In a SwiftUI source file Xcode displays a window with a Split View. The first split is the source code and the second split is the preview.
My question is, is there a way for me to have the preview take over the entire window width (I want to collapse the source code pane and just look at the preview)?
I can easily collapse the Preview pane by dragging the split to the right to collapse (but it doesn't work in reverse). I also can toggle the preview pane by going to Editor -> Canvas in the Menu bar.
Currently I'm using SwiftUI just to get a live preview of UIKit view controllers so I'm not interested in looking at the SwiftUI source code, though I imagine displaying a full window preview in a separate window would be useful for SwiftUI developers too. You could edit the source code on one monitor and have the preview window on an external display. Is this not possible?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I'm using compositional layout with UICollectionView. In a particular section I configure the compositional layout to use an estimated height because I want self sizing items determined by Autolayout Constraints.
Now I have a custom content configuration with autolayout constraints. At runtime I hit this log about conflicting constraints:
[LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
[...]
<NSLayoutConstraint:0x6000024af160 UIImageView:0x120745520.height == 130 (active)>
<NSLayoutConstraint:0x6000024af2a0 MyCustomContentView :0x120748d60.height >= 1.04839*UIImageView:0x120745520.height (active)>
<NSLayoutConstraint:0x6000024b08c0 'UIView-Encapsulated-Layout-Height' UICollectionViewListCell:0x1214392f0.height == 44 (active)>
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x6000024af160 UIImageView:0x120745520.height == 130 (active)>
The "UIView-Encapsulated-Layout-Height" on UICollectionViewListCell with a value of 44.0 appears to be a constraint created by the system. I'm not sure why a hard coded height of 44.0 is being used when the compositional layout is returning a section that only uses estimated heights (created via NSCollectionLayoutDimension estimatedDimension).
Any ideas how I can avoid this? I'm not using custom UICollectionView cells but I am using a custom content configuration and a custom content view and setting my content configuration on a UICollectionViewListCell.
I have a UIViewController subclass I'm using in Mac Catalyst. This view controller is only ever presented as a sheet. When I try to make a live preview for it the preview is displayed a gigantic size (not the sheet's actual size at runtime). I made a separate thread about this: https://developer.apple.com/forums/thread/738641
In order to be able to preview the view controller for Mac Catalyst at the desired size I figured I'd present it on another view controller.
#Preview {
let wrapperVC = WrapperViewController()
return wrapperVC
}
//In WrapperViewController
override func viewDidAppear(_ animated: Bool)
{
super.viewDidAppear(animated)
if (firstViewDidAppear)
{
firstViewDidAppear = false
view.backgroundColor = UIColor.yellow
let realVC = ActualVCIWantToPreview()
realVC.modalPresentationStyle = .formSheet
present(realVC, animated: false);
}
}
But that's not working. However if I change the device from Mac to iPad it does work so it appears modal presentations aren't working for Live Previews on Mac Catalyst (unless I'm doing something wrong but Xcode is reporting no errors it just isn't showing my presented view controller).
Been testing all day and receipt loading has been working (testing in sandbox) on Mac Catalyst. I'm using StoreKit1. All of a sudden I'm getting the following error when refreshing a receipt:
**
Error Domain=AMSErrorDomain Code=203 "Bag Load Failed Unable to retrieve app-receipt-create because we failed to load the bag." UserInfo={NSDebugDescription=Bag Load Failed Unable to retrieve app-receipt-create because we failed to load the bag.**
Sandbox server down?
I have a customizable NSToolbar (using in a Mac Catalyst app "optimized for Mac").
When I right click and choose "Customize toolbar" I get the following error:
Conflicting constraints detected: (
"<NSLayoutConstraint:0x6000014a24e0 NSToolbarItemGroupView:0x13de568c0.width <= 88.5 (active)>",
"<NSAutoresizingMaskLayoutConstraint:0x6000014f5f90 h=--& v=--& NSToolbarItemGroupView:0x13de568c0.width == 89 (active)>"
).
Will attempt to recover by breaking <NSLayoutConstraint:0x6000014a24e0 NSToolbarItemGroupView:0x13de568c0.width <= 88.5 (active)>.
Unable to simultaneously satisfy constraints:
(
"<NSLayoutConstraint:0x6000014a24e0 NSToolbarItemGroupView:0x13de568c0.width <= 88.5 (active)>",
"<NSAutoresizingMaskLayoutConstraint:0x6000014f5f90 h=--& v=--& NSToolbarItemGroupView:0x13de568c0.width == 89 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x6000014a24e0 NSToolbarItemGroupView:0x13de568c0.width <= 88.5 (active)>
Set the NSUserDefault >NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints to YES to have ->[NSWindow visualizeConstraints:] automatically called when this happens. And/or, set a symbolic breakpoint on LAYOUT_CONSTRAINTS_NOT_SATISFIABLE to catch this in the debugger.
I'm using WKWebView in a Mac Catalyst app (not sure if using Catalyst makes a difference but it seems WKWebView doesn't get the "full" Mac version AppKit apps do so maybe it does). When a website has a video playing and if I click the button that I guess is a Picture in Picture button next to the "close" button the web kit process gets an unrecognized selector sent to instance exception.
-[WebAVPlayerLayer startRedirectingVideoToLayer:forMode: <-- Unrecognized selector.
In debugging mode at least my app doesn't crash the video continues to play and the WKWebview is unresponsive to user interaction. I have to force quit my app.
--
I'm on Sonoma 14.0
Is there a way to programmatically launch a macOS Action Extension (related documentation: https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/Action.html)
I'm aware how to create "Action Extensions" but they only seem to be activated from NSTextView "rollover" button.
Say I know there is an action extension that works on a particular type of data can I launch it from my app? Obviously we can launch "regular" apps with NSWorkspace by bundle iD but I was wondering if there is any API where my app could directly launch an action extension as the "host app" programmatically.
I see the -resumeAllMediaPlayback: says the replacement method is -setAllMediaPlaybackSuspended:completionHandler:
I don't believe suspending and resuming media playback are matching actions, which would mean -resumeAllMediaPlayback: doesn't have a replacement API?
The deprecated -resumeAllMediaPlayback: method doesn't seem to work on Sonoma (pauseAllMediaPlaybackWithCompletionHandler: does work but resume does not).
I have a global variable in WKUserScript declared as a const in Javascript.
I load this script in a custom WKContentWorld I create with my own name (not the pageWorld or default world).
There some nasty javascript out there on most popular sites. I noticed that unhandled errors on the page can break stop my WKUserScript from working. In one particular case there is this nasty script on page for ads that uses document.write like so:
b.contentWindow.document.write(e),
b.contentWindow.document.close()
And the web inspector shows an error here "Can't create duplicate variable: 'MyGlobalVariableNameInsMyUserScriptHere'"
This script being used on the web page is going to end up getting blocked. But my question is this, isn't using my own content world supposed to protect me against this type of thing? This global javascript variable (an array) is global in my javascript file and holds some data in it but it is not inserted into the DOM. Shouldn't document.write/document.close calls from the page not cause this type of error in my user script?
And if the entire DOM is being rewritten shouldn't a new script (representing my user script) be created from scratch? I think I can avoid the error by changing the variable from const to var (haven't tried yet). But is this how it's supposed to be?
I'm aware signing in to an Apple ID on a macOS Virtual Machine is not supported, unfortunately. But is there a way to download Xcode from within the VM? I know the developer website used to have links where you could directly download Xcode outside the Mac App Store but I can't seem to find it?
I'm trying to convert a PyTorch forward Transformer model to CoreML but am running into several issues, like these errors:
"For mlprogram, inputs with infinite upper_bound is not allowed. Please set upper.
bound"
570
• to a positive value in "RangeDim)" for the "inputs" param in ct.convert().'
raise NotImplementedError (
259
"inplace_ops pass doesn't yet support append op inside conditional"
Are there any more samples besides https://developer.apple.com/videos/play/tech-talks/10154
The sample in that video an imageType is used as input but in my model text is the input (and the output).
I also get warned that converting "torch script" is experimental but in the video it says it a torch script is required to convert (though I know the video is a few years old).
For awhile I've wrapped OSLog in my own macros to include the line number and source file the logging statement originates from in debug mode because OSLog didn't include that info in console output (until recently).
Now I noticed the source code file and line number of the logging statement isn't being shown (I have all the metadata switches turned on in Xcode's console "Metadata Options" popover). Then I realized it is being shown, only on mouse hover over the logging statement in very tiny text.
The text is barely readable (on mouse hover). Why would viewing the line number require me to move the mouse cursor over a logging statement? It doesn't look pretty at all (hiding information behind mouse hover) and even if it did look pretty, this is the console for programmers and we don't care about such nonsense.
I'm looking for the AVAudioEngine in Practice video from WWDC 2014 (session 502) but can't seem to find it anywhere.
Does anyone have a link to this session video? I can only find the slides. Thanks.
I have a PCM audio buffer (AVAudioPCMFormatInt16). When I try to play it using AVPlayerNode / AVAudioEngine an exception is thrown:
"[[busArray objectAtIndexedSubscript:(NSUInteger)element] setFormat:format error:&nsErr]: returned false, error Error Domain=NSOSStatusErrorDomain Code=-10868
(related thread https://forums.developer.apple.com/forums/thread/700497?answerId=780530022#780530022)
If I convert the buffer to AVAudioPCMFormatFloat32 playback works.
My questions are:
Does AVAudioEngine / AVPlayerNode require AVAudioPCMBuffer to be in the Float32 format? Is there a way I can configure it to accept another format instead for my application?
If 1 is YES is this documented anywhere?
If 1 is YES is this required format subject to change at any point?
Thanks!
I was looking to watch the "AVAudioEngine in Practice" session video from WWDC 2014 but I can't find it anywhere (https://forums.developer.apple.com/forums/thread/747008).
Does anyone know why the following call fails?
CGPDFOperatorTableSetCallback(operatorTable, "ID", &callback);
The PDF specification seems to indicate that ID is an operator?
BTW what is the proper topic/subtopic for questions about Quartz? Wasn't sure what topic on the new forums to post this under.