Please look at that code:
class Mut {
var zetstruct = MutStr(z: 5) {
didSet {
print("struct was change")
zetstruct.addZet(num: 10)
}
}
struct MutStr {
var z: Int
mutating func addZet(num: Int) {
z += num
This code work:
let one: Int ? = 5
let two = 5
let result = one == two
print ( result )
//print true
Why we can access to Optional value without unwrap within comparison operations?
--
Седых Александр___
swift-users mailing list
swift-users@sw
Assume we have this code:
Immediately two Timer's closures captured two copy of initial values of
instance Test, with internal num values is 0.
//: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
struct Test {
var num = 0
mutating
Hello.
I have a simple expression with Any and is not work. Why?
var dictarray: [[ String : Any ]] = [[ "kek" : nil ]]
\\ Nil is not compatible with expected dictionary value type 'Any'
--
And in other hand this is work
var dictarray: [[ String : Any ]] = [[:]] \\ [[:]], dictarray .c
Hello everyone!
Please, tell, where I can read about "Self" requirement in protocols? Because
in Book no words about it.
Thanks
--
Седых Александр
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users
Hello. Please explain me, why we can't make Nested Types in Generic Types?
--
Седых Александр___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users
Hello again :)
I have another question.
Why Type casting for Keys of Dictionaries don't work
enum Key {
case one
}
let dict: [ AnyHashable : Any ] = [ Key . one : "Hello" ]
let unwrap: [ Key : Any ] = dict as ! [ Key : Any ] // error
--
Седых Александр_
Hello.
I stumbled on ambiguous behaviour of compiler. Is not allowed explicitly
indicate type in Generic typealias.
struct Сarriage {
let g = [ T ]()
}
struct Coma {
typealias R = Сarriage < T >
let m = R ()
let d = R < String >() \\ error: cannot specialize non-generic
Hello. I have protocol witch allow type to handle it's position and function
who handle this position and compiler get me error. Please, tell, Why I can not
use protocol name in inout function? The example here.
protocol Position {
var x: Double { get set }
}
struct Car: Position {
ut they are not interchangeable. See below:
>
>> On May 26, 2017, at 00:33, Седых Александр via swift-users <
>> swift-users@swift.org > wrote:
>>
>> protocol Position {
>> var x: Double { getset }
>> }
>>
>> struct Car: Position {
>>
Hello
For me more good use nested function instead of closure. How in this case right
way to define capture list?
//With Closure
class Sender {
var color = "Orange"
var writer = Receiver ()
func something() {
writer . callback = { [weak self ] newCol
Hello.
I try to get difference between two ranges. For instance I have to know how
many meters from me to target who have own size (or range).
let range = 0 ... 5
let meFromPoint = 0 ... 10
let setRange = Set ( range )
let setMeFromPoint = Set ( meFromPoint )
let diff = setMeFromPoint .
Hello.
I start learn Swift Package Manager.
Is exist a simple way to generate Xcode project with file Package.swift (which
download all code) for iOS template in Xcode?
Something about
$ swift package init --ios template =))
--
Alex Sedikh___
swift-
Please explain, what is conditional conformances with another words?
> Среда, 6 декабря 2017, 6:32 +03:00 от Matt Whiteside via swift-users
> :
>
> Hello Swift Users,
>
> [This is a resend with smaller attachment] Has anyone had luck passing the
> new '-enable-experimental-conditional-confor
Hello.
For example we have
Class A {}
Struct B {}
And code 'let b = B()' will do much faster than code 'let a = A()'
And therefore code 'let d = Date()' is fast, because Date is struct?
And I can use it in huge cycles fearlessly?
--
Alexandr Sedykh___
Well, for example in Python we can run another program from interpreter by
import subprocess
result = subprocess.run('ruby script.rb').stdout
My question is next:
Can we do something from Swift file at runtime or maybe from terminal via REPL
And can you send me resource when I can read about
16 matches
Mail list logo