|
Re: UIImageView Scaling
Questions:
1. Do you get different sizing behavior for the same image depending on which case/path gets taken?
2. How does the UIImageView size compare with image.size for the misbehaving case?
Questions:
1. Do you get different sizing behavior for the same image depending on which case/path gets taken?
2. How does the UIImageView size compare with image.size for the misbehaving case?
|
By
Steve Christensen
·
#616
·
|
|
UIImageView Scaling
I have a UIImageView, which I load with the following function:
func loadData() {
guard let recipe = recipe,
let fileN = recipe.photo,
!fileN.isEmpty else {
imageView.image = nil
I have a UIImageView, which I load with the following function:
func loadData() {
guard let recipe = recipe,
let fileN = recipe.photo,
!fileN.isEmpty else {
imageView.image = nil
|
By
Rick Aurbach
·
#615
·
|
|
Is sandboxing doing some weird caching of alias files?
I have a little app that writes alias files to its App Support folder on a regular basis. The app is sandboxed, so that ends up in ~/Library/Containers/<apputi>/Data/Library/Application
I have a little app that writes alias files to its App Support folder on a regular basis. The app is sandboxed, so that ends up in ~/Library/Containers/<apputi>/Data/Library/Application
|
By
Steve Mills
·
#614
·
|
|
Re: Translate Services Menu to Swift
I did.
The error message is:
Cannot find service provider for selector nnn:userData:error: or nnn:: for service nnn
Which suggest that two selectors are indeed tried.
That is: Objective-C uses the
I did.
The error message is:
Cannot find service provider for selector nnn:userData:error: or nnn:: for service nnn
Which suggest that two selectors are indeed tried.
That is: Objective-C uses the
|
By
Gerriet M. Denkmann
·
#613
·
|
|
Re: Translate Services Menu to Swift
This doesn’t look right, and I don’t know why it works. If you put the name “nnn” in the info.plist, the selector it looks up should be “nnn:userData:error:”. The Swift 4 function
This doesn’t look right, and I don’t know why it works. If you put the name “nnn” in the info.plist, the selector it looks up should be “nnn:userData:error:”. The Swift 4 function
|
By
Quincey Morris
·
#612
·
|
|
Re: Translate Services Menu to Swift
Now this is ok:
@objc func nnn(_ pboard: NSPasteboard, _ userData: String)
Where nnn = value of “Instance Method name” from Info.plist
I am sure this is very well documented somewhere.
The
Now this is ok:
@objc func nnn(_ pboard: NSPasteboard, _ userData: String)
Where nnn = value of “Instance Method name” from Info.plist
I am sure this is very well documented somewhere.
The
|
By
Gerriet M. Denkmann
·
#611
·
|
|
Re: How to call Swift from Objective-C
This does work:
@objc public func abc() { print(#function) }
Well, it did, but hidden somewhere in DerivedData/…
Now it works.
Sorry for the noise.
Gerriet
This does work:
@objc public func abc() { print(#function) }
Well, it did, but hidden somewhere in DerivedData/…
Now it works.
Sorry for the noise.
Gerriet
|
By
Gerriet M. Denkmann
·
#610
·
|
|
How to call Swift from Objective-C
I have a Swift project called TestSwift:
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate
{
@IBOutlet weak var window: NSWindow!
func
I have a Swift project called TestSwift:
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate
{
@IBOutlet weak var window: NSWindow!
func
|
By
Gerriet M. Denkmann
·
#609
·
|
|
Translate Services Menu to Swift
This works:
- (void)lookUppString:(NSPasteboard *)pboard userData:(NSString *)data error:(NSString * _Nullable *)error
{
NSLog(@“%s",__FUNCTION__);
}
But this does not:
func lookUppString(_
This works:
- (void)lookUppString:(NSPasteboard *)pboard userData:(NSString *)data error:(NSString * _Nullable *)error
{
NSLog(@“%s",__FUNCTION__);
}
But this does not:
func lookUppString(_
|
By
Gerriet M. Denkmann
·
#608
·
|
|
Re: Swift with NSDocument and Revert To... browse all versions.
Well, things get more complicated when you use non-Obj-C types, but it’s not necessarily true that you can’t use Swift types. In the case of the model, it may be sufficient that your “model"
Well, things get more complicated when you use non-Obj-C types, but it’s not necessarily true that you can’t use Swift types. In the case of the model, it may be sufficient that your “model"
|
By
Quincey Morris
·
#607
·
|
|
Re: Swift with NSDocument and Revert To... browse all versions.
Thank you,
You are spot on with explaining the problem and I understand your answer and concerns. Sending up a NotificationCenter rocket in read(from:ofType:) confirms your explanation.
Unless I’m
Thank you,
You are spot on with explaining the problem and I understand your answer and concerns. Sending up a NotificationCenter rocket in read(from:ofType:) confirms your explanation.
Unless I’m
|
By
Bill Pitcher
·
#606
·
|
|
Re: Swift with NSDocument and Revert To... browse all versions.
Well, you’re Doing It Wrong™, but it’s not entirely your fault. This is one of NSDocument’s big messes that we’ve been stuck with for the last 10 years or so.
What’s actually going wrong
Well, you’re Doing It Wrong™, but it’s not entirely your fault. This is one of NSDocument’s big messes that we’ve been stuck with for the last 10 years or so.
What’s actually going wrong
|
By
Quincey Morris
·
#605
·
|
|
Re: Swift with NSDocument and Revert To... browse all versions.
Firstly I’ve uploaded a very cut down project which shows the problem.
https://www.ilike.co.nz/downloads/testDocument.zip
"Propagate the data reversion to your window controller and view
Firstly I’ve uploaded a very cut down project which shows the problem.
https://www.ilike.co.nz/downloads/testDocument.zip
"Propagate the data reversion to your window controller and view
|
By
Bill Pitcher
·
#604
·
|
|
Re: Swift with NSDocument and Revert To... browse all versions.
Propagate the data reversion to your window controller and view controllers can be difficult, because any setup you did in windowDidLoad/viewDidLoad is not automatically redone. It can be especially
Propagate the data reversion to your window controller and view controllers can be difficult, because any setup you did in windowDidLoad/viewDidLoad is not automatically redone. It can be especially
|
By
Quincey Morris
·
#603
·
|
|
Swift with NSDocument and Revert To... browse all versions.
I've been trying track the correct path from document to Control and back again.
Document automatically loads WindowController.document I use didSet to loop down the ViewControllers and set there
I've been trying track the correct path from document to Control and back again.
Document automatically loads WindowController.document I use didSet to loop down the ViewControllers and set there
|
By
Bill Pitcher
·
#602
·
|
|
WkWebView delegates
macOS 13.5
I made a WkWebView and added navigationDelegate and uiDelegate and implemented (almost) all delegate methods, each containing a print().
1. I never see any prints (running in Xcode)
2.
macOS 13.5
I made a WkWebView and added navigationDelegate and uiDelegate and implemented (almost) all delegate methods, each containing a print().
1. I never see any prints (running in Xcode)
2.
|
By
Gerriet M. Denkmann
·
#601
·
|
|
Re: lazy variables in Swift - should be read-only
You can do something like this:
It’s settable from within its class or struct, but not from outside, which is as close as you can get to ‘lazy let’ AFAIK.
You can do something like this:
It’s settable from within its class or struct, but not from outside, which is as close as you can get to ‘lazy let’ AFAIK.
|
By
Quincey Morris
·
#600
·
|
|
lazy variables in Swift - should be read-only
This works:
lazy var session = makeSession()
func makeSession() -> URLSession
{
let sessionConfig = URLSessionConfiguration.ephemeral
return URLSession( configuration: sessionConfig )
}
First: is
This works:
lazy var session = makeSession()
func makeSession() -> URLSession
{
let sessionConfig = URLSessionConfiguration.ephemeral
return URLSession( configuration: sessionConfig )
}
First: is
|
By
Gerriet M. Denkmann
·
#599
·
|
|
Re: How to get DOMDocument from WkWebView
AFAIK, there are no documented limits and I believe you aren’t subject to a number of same-origin policies, but this is Apple so who knows. Anyway, you inject JavaScripts using a
AFAIK, there are no documented limits and I believe you aren’t subject to a number of same-origin policies, but this is Apple so who knows. Anyway, you inject JavaScripts using a
|
By
Keary Suska
·
#598
·
|
|
Re: How to get DOMDocument from WkWebView
If the web-page I am interested in is *not* under my control, could I still "write the DOM stuff in JavaScript” ?
If so: how would I start doing this?
Currently I am doing stuff like:
get
If the web-page I am interested in is *not* under my control, could I still "write the DOM stuff in JavaScript” ?
If so: how would I start doing this?
Currently I am doing stuff like:
get
|
By
Gerriet M. Denkmann
·
#597
·
|