In this app, I have:
a VC as entry point (root)
which segues (push) to a SplitViewController
On iPad, when I get into the splitView, I can get back to the root by dragging down the split view.
But on iPhone, this does not work: even though presentation is .automatic, Splitview covers all screen. No way to get back.
I tried to create a back button in the detail views…
Could not get it.
What is the best way to do this ?
is there a setup for the initial segue or the views presentation modes to allow pop back ?
can I add a back button ? Where, calling what action to return ?
I cannot embed splitViewController in nav stack …
I would like to have the same solution on both iPhone and iPad…
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
In the new version of download > More, there doesn't seem to be a way to filter search efficiently. I searched for instance for MacOS (to see all releases). I get a very long list (200+) references, with a lot of Xcode, but nothing specific to MacOS.
If I search for Xcode 11, I get all Xcode references:
I added quotes to try and force an exact search, I just get a Java extension…
That was not the case in the previous version of the more page. Or do I miss something ?
How to reorder a pdf document?
move page p after page n, or at a given m position.
add new page at certain position
rotate a page 90° or 180°.
I've seen libraries, but I would prefer to redevelop those simple functions directly in an iOS app (Swift).
I don't need to edit the document content, just rearrange.
I use UIActivityViewController to airDrop pdfFile (pdfURL) from iPhone to iMac.
Works well, file is airDropped.
let activityVC = UIActivityViewController(activityItems: [pdfURL], applicationActivities: nil)
present(activityVC, animated: true, completion: nil)
I want to customise it:
limit services to AIrDrop and mail
How can I exclude such services as WhatsApp, Notes… ?
perform some action once the file has completed airDrop or once cancelled.
I tried to implement with completionWithItemsHandler:
activityVC.completionWithItemsHandler = { (activity, success, items, error) in
print("Completed")
}
This doesn't work, print is not executed.
My ultimate goal is to close the activityVC automatically once action was completed, without need to tap close button.
Should I define some content for applicationActivities ?
I get this weird behaviour of Xcode.
Version 13.2.1 or 13.2 RC (may be other).
In the storyboard I had a UITableViewController. As it does not give any flexibility to add other views in the VC, I created a new UIViewController, recreated the tableView inside as well as some other objects, added the new views I needed, redid all connections.
Then I removed the UITableViewController.
Everything works perfectly fine.
But sometimes (cannot find any pattern for the cases), when opening the project, the old UITableViewController appears in Storyboard. The new UIViewController doesn't even seem to be here. When I select different VC in SB, no information in Identity inspector or other inspector.
But it compiles and runs OK, using the new UIViewController.
I cleaned build folder, closed Xcode, reboot the Mac, to no avail.
Only way to get it solved was to close the SB and reopen it…
Is there a cache somewhere in SB that is not cleared ?
Since a few hours, Sat 1/29/2022, several pages of the forum do not open, such as:
https://developer.apple.com/forums/
https://developer.apple.com/forums/tags/ios
all showing the same messages:
Other tags open without problem.
And those open with a payload:
https://developer.apple.com/forums/?page=1&sortBy=lastUpdated
https://developer.apple.com/forums/search/?q=column&page=1&sortBy=lastUpdated
https://developer.apple.com/forums/tags/ios/?page=2 works, but page=1 doesn't
Does anyone experience the same errors ?
Conf:
MacOS 12.2 (21D49)
Safari Technology Preview Release 139 (Safari 15.4, WebKit 17613.1.14.41.3)
But the pages open correctly on Firefox, Chrome.
Does not open either on Safari Version 15.3 (17612.4.9.1.5)
So issue is apparently on Safari probably not MacOS 12.2 (21D49) , nor on server side.
I get a surprising crash when adapting constraints.
Xcode 13.2.1
iOS 15.2 on simulator
Here is the set up in storyboard:
A subclass of UIView (PopoverView) to draw a popover like frame and label and button inside.
PopoverView can set its arrow position all around, for instance on the right, so that popover will appear on the left of an object,
or on the left, to appear on the right.
Button tap is used to loop through the arrow position.
I have defined constraints (and their IBOutlets), and notably for the centerX position of popoverView to centerX of the label.
I adapt the value of the constraints in viewWillLayoutSubviews to position the popover in correct position relative to the label.
Now the problem.
To position the popover on the right of the label, I set its centerX constraint as follows in viewWillLayoutSubviews():
popoverCenterToLabelCenterConstraint.constant = (popoverLabel.frame.width + label.frame.width) / 2
That works OK
To position the popover on the left of the label, I set its constraint as follows (offset the opposite value):
popoverCenterToLabelCenterConstraint.constant = -(popoverLabel.frame.width + label.frame.width) / 2
I also tried:
popoverCenterToLabelCenterConstraint.constant = -popoverLabel.frame.width / 2 - label.frame.width / 2
App does not crash but hangs, apparently in an infinite loop.
Idem if I divide by 2.0 instead of 2 : label.frame.width / 2.0
The width of the label, at this point of code, is 92.33333333333333
So I replaced by the value directly:
popoverCenterToLabelCenterConstraint.constant = -popoverLabel.frame.width / 2 - 46.2
and it works OK. Idem with 46.1
So the problem is not due to the position of popoverView
If I replace the div by 2 by 2.01 :
- popoverCenterToLabelCenterConstraint.constant = -popoverLabel.frame.width / 2 - label.frame.width / 2.01
it works !!!!!!
Conclusion: it is the exact div by 2 that causes the hanging.
What could be the reason for this strange behaviour ?
Here is the set up:
I try to set a constraint for the top of tableView relative to safe area.
No way by control-drag from tableView to Safe area.
But if i create such a constraint for another object (here, like upperView) and then edit the constraint in Inspector, I can replace UpperView by tableView ; and get my constraint set.
What am I missing here ?
I need to implement a remote control for a SwiftUI app running on iPad.
I would need to handle 2 different events like Start / Stop.
On software side, I plan to use .onReceive to listen to BLE device.
So my questions:
I need realtime reaction (a few 1/100 s max)
can any BLE remote control do the job ?
If anyone has tested some low cost remote, I am interested to know.
Or should I look for Homekit solutions ?
Or use an iPhone as remote controller ?
I have encountered the following problem with a List.
The setup is as follows
@State private var allItems : [SomeItem]
@State private var selected : SomeItem?
// in the body
List(allItems, $selection) { theItem in …
}
where SomeItem is a struct.
When some properties of an item in allItems changes, the values that I read in theItem are not updated.
Just as if old content was cached.
I changed allItems to a computed var and everything works OK.
I read this SO thread https://stackoverflow.com/questions/74083515/swiftui-list-item-not-updated-if-model-is-wrapped-in-state
but that does not give a full explanation.
So my questions:
Is there effectively an issue here ?
when is it safe to use a State var as the Content of List ?
Is it OK (it seems) if the properties of items do not change ?
It seems also OK if the list of allItems is modified (appended, reduced) without problem changing the properties of its elements.
How to do if needed to change both allItems (append for instance) and change the properties of some items, as computed var cannot be modified.
Hope the question is clear.
Last night we change hour for daylight saving time (at 2:00 it would be 3:00).
So I made a simple test to set an alarm at 2:10
At 1:59, clock jumped logically to 3:00
no alarm
At 3:10, alarm rang (in fact I had turned it off and back on, but that has no influence)
I set an alarm at 3:15, of course it rang
I set a new alarm at 2:20
It rang at 3:20
Conclusion: Clock app "replicates" the alarms between 2:00 and 2:59 into 3:00 - 3:59.
Which is great, not to miss any.
Question: Is this specific to Clock app or a more general system behaviour for all time events ?
If so, there may be a side effect:
I set an event A to turn On a light at 2:45
And set event B to turn it Off at 3:15
Then B will occur before A and the light will remain On
There is no perfect solution ("warping" 2:00 - 2:59 into a minute at 3:00 would creates other issues).
Extra question: What happens on winter time ? Will alarm ring twice at 2:10 ?
I have declared an array as a State var
@State var proba : [Int] = [10, 40, 40, 10]
The array is updated in onAppear :
.onAppear {
proba = arrayOfTuples.map { (proba, _) in proba }
print("proba", proba)
}
The array is used for TextFields:
ForEach(0..<proba.count, id: \.self) { index in
TextField("N", value: $proba[index], format: .number)
.frame(width: 40)
.onChange(of: proba_kWh[index], perform: {[oldValue = proba_kWh[index]]
newValue in
print("proba onChange", index, oldValue, proba[index], newValue)
})
When View appears, I get some onChange (as initial values did change)
proba [10, 20, 60, 10] // onAppear changes 2 values: 1 and 2
proba onChange 2 40 60 60 // index 2 is changed before 1
proba onChange 1 40 20 20
I know that order of execution is not guaranteed, but in this specific case, I did thought it would be in the order of the array reading…
I have an app that runs eitheir as MacOS or iPadOS.
After a few changes to adapt to API differences (PasteBoard notably), app runs OK on both.
But the layout of views is messy when running on iPad.
Reason seems to be that Text are not using the same default font size, or that the same system font size does not use the same space. Same issue when using segmented picker for instance.
Configuration:
Xcode 14.2
MacOS 12.6.6
Simulator: iPad Pro (12.9") - iOS 16.2
Is it a correct analysis ?
Is there a simple workaround, to avoid the need to redesign all views for iPadOS ?
If I run the exact same code on MacOS 12.7 (Xcode 14.2) and MacOS 15.0.1 (Xcode 15.0.1).
In a scrollView, I display lines (lineDivider) and then a LazyVgrid, applying some offset:
ScrollView(.vertical) {
ForEach(1...50, id: \.self) { index in
LabelledDivider(label: "\(index)", color: .gray.opacity(0.1))
.offset(y: CGFloat(65*index - 50)
}
LazyVGrid(columns: gridItemLayout, spacing: 33 ) {
ForEach ($allItems.theItems) { $item in
ItemView(item: item)
}
}
.offset(y: 40)
}
In Xcode 14.2, I get the first layout and in Xcode 15.0 the second on right:
The divider line is at the same position, but the view in grid is not.
If I change
.offset(y: 40)
to
.offset(y: 60)
I get the same layout.
So my questions:
did anyone observe similar change ?
is it due to Xcode, to MacOS ?
Is it documented somewhere ?
This app allows to take photos.
It works OK, but since recently I get the following error message:
ERROR: PHOTO not found in table CameraUI-SpatialVideo of bundle CFBundle 0x283e96220 </System/Library/PrivateFrameworks/CameraUI.framework> (not loaded)
What is this spatial video ? I'm just using still images, not using CameraUI.framework.