As you can see, `URL` is not equal but the `path` is. I wonder why urls do
not equal here?
let url = URL(fileURLWithPath: "foo/bar", isDirectory: false)
let baseURL = url.deletingLastPathComponent()
let newURL = URL(fileURLWithPath: "bar", isDirectory: false, relativeTo:
baseURL)
print(url ==
Xcode8 is showing a memory leak in instruments and the memory graph. I have
narrowed it down to this: deriving from NSObject produces a leak indication. I
have no idea why.
I need an NSObject to later use the @objc directive.
The Test instance stored in the mDict Dictionary is indicated as a leak
I'm puzzeled by the behavior of the automatic coercion. Specifically
when something will work and when it will not. It at least has something
to do with the platform. That much I have tracked down.
I've attached a file, bridge.swift, that on Linux will fail to compile
with the error: cannot conver
It may also work if you create a "generic" extension that can only be
applied to strings.
Then i'm guessing that you will not need to specify the type on the use.
LF
On 13/10/2016 22:44, Nevin Brackett-Rozinsky via swift-users wrote:
It works if you specify the types of the variables:
let
> On Oct 14, 2016, at 7:33 AM, Zhao Xin via swift-users
> wrote:
>
> As you can see, `URL` is not equal but the `path` is. I wonder why urls do
> not equal here?
>
> let url = URL(fileURLWithPath: "foo/bar", isDirectory: false)
> let baseURL = url.deletingLastPathComponent()
> let newURL = UR
> On Oct 14, 2016, at 11:15 AM, Ryan Lovelett via swift-users
> wrote:
>
> I'm puzzeled by the behavior of the automatic coercion. Specifically
> when something will work and when it will not. It at least has something
> to do with the platform. That much I have tracked down.
>
> I've attached
In your opinion, `baseURL` is a factor more important than `path`. I can not
unaccept your answer. But I want to know why? Is there a standard on URL
equality?
ZhaoXin
Get Outlook for iOS
_
From: Greg Parker
Sent: 星期六, 十月 15, 2016 05:40
Subject: Re
I thought below code would work. It didn't.
let count = 1
outerSwitch: switch count {
case 0, 1:
let buttonId = 0
switch buttonId {
case NSAlertFirstButtonReturn:
print("do something")
case NSAlertSecondButtonReturn:
print("do something")
case NSAlert
> On Oct 14, 2016, at 5:16 PM, zh ao via swift-users
> wrote:
>
> In your opinion, `baseURL` is a factor more important than `path`. I can not
> unaccept your answer. But I want to know why? Is there a standard on URL
> equality?
I think this is just a weirdness of NSURL (assuming you’re ru
I manage to use below work around.
let count = 1
switch count {
case 0, 1:
let buttonId = NSAlertThirdButtonReturn
let shouldFallthrough = { () -> Bool in
switch buttonId {
case NSAlertFirstButtonReturn:
print("do something")
case NSAlertSecondB
This seems like a better solution to me. The other one smacks of goto.
On Fri, Oct 14, 2016 at 20:52 Zhao Xin via swift-users <
swift-users@swift.org> wrote:
> I manage to use below work around.
>
> let count = 1
>
>
> switch count {
>
> case 0, 1:
>
> let buttonId = NSAlertThirdButtonReturn
>
You are right Jens. If I use `appendingPathComponent`, it works.
let url = URL(fileURLWithPath: "foo/bar", isDirectory: false)
let baseURL = url.deletingLastPathComponent()
let newURL = URL(fileURLWithPath: "bar", isDirectory: false, relativeTo:
baseURL)
let testURL = baseURL.appendingPathCompo
Just want to mention that there are some differences between `NSURL` and `URL`.
Here's an example from the repl:
```
1> import Foundation
2> NSURL(string: "")
$R0: NSURL? = "" {
ObjectiveC.NSObject = {}
}
3> URL(string: "")
$R1: URL? = nil
```
--
Keith Smiley
On 10/14, Jens Alfke via swi
FWIW we've overridden URL's equality function in order to get a "more realistic"
result. We lowercase everything and compare the scheme, host, port, and query,
along with normalizing the path to handle cases where `/` exists in some paths
but doesn't in others. This solves this problem as well:
``
> On Oct 14, 2016, at 10:20 PM, Keith Smiley wrote:
>
> FWIW we've overridden URL's equality function in order to get a "more
> realistic"
> result. We lowercase everything and compare the scheme, host, port, and query,
I hope you don’t lowercase everything — the scheme and host are
case-inse
In our case, if we accidentally send a URL from the server with a trailing
slash, we want that to be equivalent to one without. But yea, if you're
manipulating it you might have more problems! Although in our case we add the
slash for the case without it.
--
Keith Smiley
On 10/14, Jens Alfke wrot
16 matches
Mail list logo