I have a simple expression with Any and is not work. Why?
vardictarray: [[String: Any]] = [["kek": nil]]
\\ Nil is not compatible with expected dictionary value type 'Any'
`nil` is just a literal value that doesn't have a specific type. Even
though you want to put it in a dictionary whose
> On 15 Feb 2017, at 20:40, Greg Parker <gpar...@apple.com> wrote:
>
>> On Feb 15, 2017, at 11:11 AM, Ole Begemann via swift-users
>> <swift-users@swift.org> wrote:
>>
>> In macOS 10.12 and iOS 10.0, class properties were introduced to Objective
In macOS 10.12 and iOS 10.0, class properties were introduced to
Objective-C [1]. I noticed that the Objective-C runtime treats class
properties differently based on the deployment target. Example:
// MyClass is an Objective-C class that has a class property
let metaclass =
On 16/02/2017 04:37, Félix Fischer via swift-users wrote:
1) How do I search through the threads of the mailing list? I'm looking
for answers to Q2
The best way I've found for searching the archives is Google. Try
something like:
linux site:lists.swift.org/pipermail/swift-users
On 27/02/2017 15:17, Nate Chandler via swift-users wrote:
Hello all,
I'm encountering a behavior around object lifetime and deinitialization
that is surprising to me. Here's an approximation of what I'm encountering:
I have a class Handle whose deinit must execute on a certain queue
(let's
On 27/02/2017 19:34, Nate Chandler via swift-users wrote:
Hi Ole,
A quick follow-up--are you suggesting calling withExtendedLifetime
inside the closure passed to async, as below?
class AsyncHandle {
let handle: Handle
deinit {
let handle: Handle = self.handle
q.async
The compiler has no way of inferring the type of the generic ContentType
parameter because you're not using that parameter anywhere in the body
of the closure that could give the compiler a hint. So you have to
provide the type manually by explicitly annotating the type of the
closure's
> Hmm - interesting to know. Unfortunately, if I do that, then I get
> NO indication of selection when I click on ANY row. Perhaps I need
> to make some other changes to account for the change in how I get the
> cell?
You also need to store your cells' selection state someplace outside of
the
The more idiomatic way is to look at API design in a new way. Note these
points:
1. `Countable` variant is preferred when you want to deal with integer
ranges as it more closely matches the element type.
2. Both countable range variants share a common protocol conformance
already:
The line "let result = closure(n)" is refused by the compiler with the
error message "declaration over non closing parameter may allow it to
escape".
First off, while I know what an escaping or a non-escaping closure is, I
find this error message utterly impossible to understand. To begin with,
When I declare my closure as @noescape, (the default), I explicitly tell
the compiler that, despite the fact closing over it *may* allow it to
escape, I, the programmer, guarantee that it will not.
I would understand a warning, but I don’t understand that the compiler
insists on putting out an
What I cannot find though is the guarantee that the buffer where the
String is converted to an UTF8 sequence is always null-terminated.
I very much suspect it is, and all my tests did find a null-terminated
string.
Question: Does anybody know for sure that the buffer is always
null-terminated?
I wonder why the description method of collections use the debugDescription
method to print their elements, and not the description method.
Dmitri Gribenko gave this reason in December 2015 [1]:
Array's description shouldn't be presented to the user in raw form,
ever, so the use case here is
On 28/12/2016 19:57, Travis Griggs via swift-users wrote:
The behavior of the following playground snippet surprised me:
var source = [10, 20, 30, 40]
var stream = source.makeIterator()
stream.next() // 10
stream.next() // 20
stream.forEach { (each) in
print("\(each)")
} // prints
On 09/03/2017 08:27, Zhao Xin via swift-users wrote:
When using subscript of `String.CharacterView`, I got an unexpected error.
fatal error: Can't form a Character from an empty String
func test() {
let s = "Original Script:"
let cs = s.characters
//let startIndex =
On 12/03/2017 16:58, Don Giovanni via swift-users wrote:
I'm trying to adopt the RandomAccessCollection protocol from a class. I
deliberately leave out the func index(before:) function because there
is already a default implementation of that function in
RandomAccessCollection. I do understand
It's how protocols work in Swift.
errorDescription is a protocol requirement of LocalizedError (that is,
it's part of the protocol definition, not just added in an extension).
Only protocol requirements are dynamically dispatched.
Take a look at the implementation of
Have you tried explicitly casting the value to NSError when you pass it
to Objective-C? I think it should work then.
let myError: MyError = ...
myObjCFunc(myError as NSError)
On 02/03/2017 17:29, Ronak via swift-users wrote:
Hi everyone,
It looks like I’m still having issues exposing
One way to do this in Swift is a method called type erasure.
Type erasure means you create a new type that wraps any value whose
concrete type you want to erase. This new type also conforms to the
protocol. By convention the type is named Any... (compare AnyIterator
and AnySequence in the
On 26.04.2017 17:01, J.E. Schotsman via swift-users wrote:
On 26 Apr 2017, at 16:54, Rien wrote:
Agree, though the function should probably be named something like: withEach
instead of forEach.
Maybe worth a proposal on evolution?
Let’s wait until the people at the
The withUnsafeMutableBytes method has two generic parameters, ResultType
and ContentType:
|mutating func withUnsafeMutableBytes(_ body:
(UnsafeMutablePointer
)
throws -> ResultType) rethrows -> ResultType|
In your examples, the type checker can't infer the type of
On 25.04.2017 12:24, Rick Mann via swift-users wrote:
Not the ResultType, you mean, but the input type, right?
Yes, sorry, I meant ContentType.
Yeah, I finally figured that out, although it doesn't explain another situation
I'm experiencing that I didn't include in the post.
However, that
On 01.10.17 19:28, Muhammad Tahir Vali via swift-users wrote:
Hello,
I've updated to swift 4.0 and downloaded a CL tool swiftenv . Mixing
and debugging with different versions , I may have messed up my swift
environment variables and ultimately deleted my swift-tools. How do I
safely default
On 21.10.17 02:50, Santiago Gil via swift-users wrote:
I just ran into a bug after a Swift 4 migration where we expected
[String] and got [Character] from a flatMap since flatMap will flatten
the String since it's now a collection. While I understand why
flatMap behaves this way now that
24 matches
Mail list logo