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 ?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I try to rotate a page 180° in a pdf file.
I nearly get it, but the page is also mirrored horizontally.
Some images to illustrate:
Initial page:
Result after rotation (see code): it is rotated 180° BUT mirrored horizontally as well:
The expected result
It is just as if it was rotated 180°, around the x axis of the page. And I would need to rotate 180° around z axis (perpendicular to the page). It is probably the result of
writeContext!.scaleBy(x: 1, y: -1)
I have tried a lot of changes for transform, translate, scale parameters, including removing calls to some of them, to no avail.
@IBAction func createNewPDF(_ sender: UIButton) {
var originalPdfDocument: CGPDFDocument!
let urls = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
let documentsDirectory = urls[0]
// read some pdf from bundle for test
if let path = Bundle.main.path(forResource: "Test", ofType: "pdf"), let pdf = CGPDFDocument(URL(fileURLWithPath: path) as CFURL) {
originalPdfDocument = pdf
} else { return }
// create new pdf
let modifiedPdfURL = documentsDirectory.appendingPathComponent("Modified.pdf")
guard let page = originalPdfDocument.page(at: 1) else { return } // Starts at page 1
var mediaBox: CGRect = page.getBoxRect(CGPDFBox.mediaBox) // mediabox which will set the height and width of page
let writeContext = CGContext(modifiedPdfURL as CFURL, mediaBox: &mediaBox, nil) // get the context
var pageRect: CGRect = page.getBoxRect(CGPDFBox.mediaBox) // get the page rect
writeContext!.beginPage(mediaBox: &pageRect)
let m = page.getDrawingTransform(.mediaBox, rect: mediaBox, rotate: 0, preserveAspectRatio: true) // Because of rotate 0, no effect ; changed rotate to 180, then get an empty page
writeContext!.translateBy(x: 0, y: pageRect.size.height)
writeContext!.scaleBy(x: 1, y: -1)
writeContext!.concatenate(m)
writeContext!.clip(to: pageRect)
writeContext!.drawPDFPage(page) // draw content in page
writeContext!.endPage() // end the current page
writeContext!.closePDF()
}
Note: This is a follow up of a previous thread,
https://developer.apple.com/forums/thread/688436
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 ?
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 use a ViewBuilder to generate the destination used in a NavigationSplitView (to select the detail View).
This viewBuilder depends on a parameter (in fact 2, but I try to simplify).
ViewBuilder is simple, just calls a View:
@ViewBuilder func destination(object: SomeObject, name: String) -> some View {
MyView(objToUse: object, nameToUse: name)
}
But this does not work. When I change the selection in the Master of the splitView, view is not updated (even though I've checked the content is updated.
This si so simple that I started using directly
MyView(objToUse: object, nameToUse: name)
in the detail View.
It did not work either.
Now, here is the surprise: if I use a switch statement in the ViewBuilder, it works:
Let's say we have:
struct SomeContent: Hashable, Identifiable, Codable {
var id = UUID()
var name: String
}
struct Object : Hashable, Identifiable, Equatable, Codable {
var id = UUID()
var content: [SomeContent] = []
}
So I define a func to get all the names
func allNames(of object: SomeObject) -> [String] {
var names : [String] = []
for o in object.content {
names.append(o.name)
}
return names
}
And modify ViewBuilder as follows: it works
@ViewBuilder func destination(object: SomeObject, name: String) -> some View {
let names : [String] = allNames(of: object)
switch name {
case names[0]: MyView(objToUse: object, nameToUse: name)
case names[1]: MyView(objToUse: object, nameToUse: name)
case names[2]: MyView(objToUse: object, nameToUse: name)
default: EmptyView()
}
It also works with nested if else if instead of a switch.
What is it I am missing ?
This is a SwiftUI Mac App.
There is an observable object with a published array
class AllObjects : ObservableObject {
@Published var theItems = [Item]()
}
In the View, observed with:
@ObservedObject var allObjects : AllObjects
Item class is :
class Item: ObservableObject, Identifiable {
let id = UUID()
var placeNo = 1
// Other properties
}
When I switch dark / light mode within the app (with a toggle)
@Environment(\.colorScheme) var colorScheme
the ObservedObject allObjects is modified: array is emptied: allObjects.theItems is now an empty array.
What could cause the change to theItems ? I have checked that the only func un which theItems is reset to [] is not called.
I read in Xcode 15.2 release notes that @IBDesignable and @Inspectable are deprecated and will disappear in a future release.
After the abandon of WatchKit and its storyboard, replaced by SwiftUI, does it mean storyboards (and consequently UIKit) will progressively disappear, leaving developers alone with SwiftUI to design apps (IMHO, inadequate to design complex UI: for instance, I always struggle to position precisely objects for all devices sizes as we miss constraints manager in SwiftUI) ?
For sure, IBDesignable is (was) whimsical, but a very useful tool to design sophisticated UI. Replacing by #Preview does not make it.
I also understand that Xcode is a very complex piece of code and that maintaining and evolving some tools (as IBDesignable) requires effort. But isn't it what we expect from Apple ? To provide us with the best tools and keep on the promise of WYSIWYG environments, all along ?
Is it only me or do others share this view ?
Is it only me ?
I received recently a notification that an answer was "recommended by Apple", with a link to the post.
But when going to the post, this recommendation (with small Apple icon) do not show.
And the forum scores are not updated.
This is not the first time I get problems with forum notifications.
I filed a bug report: FB14172207
I get a crash in Apple Watch simulator (Series 9 45mm 18.0) as soon as the app launch if I type anything on external keyboard (just hitting command key for instance to capture a screenshot). Same crash on series 7 (45mm, OS 18.1)
But app works normally when I use mouse to interact with the app on simulator.
App does not crash on real device (Watch 4 OS 10.4.1).
Nor does it crash on Series 6 simulator (44 mm OS 17.4).
Here are the log I could collect (apparently, they contain sensitive language !!! so I attach as a file.:
Attached logs
I create a notification with an image attachment:
let center = UNUserNotificationCenter.current()
center.delegate = self
let content = UNMutableNotificationContent()
// some more stuff…
let paths = NSSearchPathForDirectoriesInDomains(
FileManager.SearchPathDirectory.documentDirectory,
FileManager.SearchPathDomainMask.userDomainMask, true)
let documentsDirectory = paths[0] as NSString
let fileExtPNG = "#" + "\(imageName)" + " photo.png"
let fileNamePNG = documentsDirectory.appendingPathComponent(fileExtPNG) as String
url = URL(fileURLWithPath: fileNamePNG)
let attachment = try UNNotificationAttachment(identifier: "Image", url: url, options: nil)
content.attachments = [attachment]
I then add the request:
let request = UNNotificationRequest(identifier:requestIdentifier, content: content, trigger: nil)
center.removePendingNotificationRequests(withIdentifiers: [requestIdentifier])
center.add(request) {(error) in }
Problem: when I later test (once notification has been registered), the file do not exist anymore at the url.
I've commented out the add request to confirm.
I have a work around, by creating a temporary copy of the file at the URL and pass it in the attachment.
Then, everything works fine and the copy is deleted.
But that's a bit bizarre. What am I missing here ?
I repeat this older thread, as it does not show on the forum with my added post !https://forums.developer.apple.com/message/298938#298938I answered to KMT answer (I read the referenced thread)---------------Looks like that triggered the name change dialog.Can you just right click on the watch name without that happening? Try it on the phone, on the left so see what I'm looking for.Otherwise, this sounds like what others went thru (routine pairing v o o d o o ) in this SO thread - seen it ? [ filter does not like v o o …]https://stackoverflow.com/questions/30792520/in-xcode-i-see-no-paired-apple-watch-even-though-the-watch-is-paired-and-the-w-------------------------So, my question nowI run in the same problem.I just got the Apple Watch (4, OS 5.1.1) and use XCode 10.1. OSX 10.13.6I can create the app + WatchOS on simulator without problem. But not on device.The watch is paired with iPhone.I connect iPhone with USB=> get the message :The iPhone "iPhone XS" can not be used because it requires iTunes 12.9 or later. Do you want to download the latest version of iTunes now?I ignore the message (as I think iTunes 12.9 requires Mojave, isn't it ?). Could it be the problem ???In XCode, I select the scheme iPhone Xs of XXX + Apple Watch of XXXI run, it compiles OK, but at the end says:"Finished running myApp on Apple Watch of XXX" in the XCode barPlus alert:App installation failedThe host is not paired with the device.I have checked in XCode Devices:- on the left, I see iPhoneXS of XXX- but not the Watch- On the right of Devices window, I see the PAIRED WATCHES:Apple Watch of XXXI also checked that Apple Watch is listed with an UDID in the Devices listThe scheme was in Debug mode.So, I changed to release mode, and get the message in Scheme that paired devices not available for debug.So, Compile again, but then get message :Could not launch 'Autonomie' on iPhone XS XXXThere was an error preparing Apple Watch de XXX for development.Try reattaching the device to which Apple Watch de XXX is paired. The device rejected the pairing attempt.So I unpaired the device.ReattachedTruted the hostRun again, just to get again the messageThe host is not paired with the device.I do not see which and where I should pair.
Do you use third party framweworks, like Alamofire ?
One of my production Mac is still on Mojave. I want to update to Catalina and not Big Sur (waiting for dust to settle down).
Automatic update from system preferences only proposes Big Sur as well as some patch updates for MacOS 10.14.6
What is the safe and sure way to update from Mojave to the latest Catalina ?
I have created a new entry in the capability list (background modes)
None is selected, so that seems to have no effect.
However, I would like to remove this entry to clean the screen. But I cannot find any "-" button, nor contextual menu, nor editing in XML…
Is it simply possible to remove ?
When testing in simulator with Xcode 13, I noted a subtle difference in the display of WKInterfaceLabel between Watch series 6 and series 7.
WKInterfaceLabel is in a WKInterfaceGroup.
On Series 7: the text Fast Driving is clipped with round corner at top and bottom
On Series 6, round clipping is much less (noticeable on leading F and D)
I could not find what parameter has changed in IB nor how to change this round corner value. Nor why such a change ?