-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
101 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import UIKit | ||
|
||
struct Channel<T> { | ||
var value: T | ||
|
||
} | ||
|
||
func update<T>( channel: Channel<T>, newValue: Any ) throws -> Any { | ||
print( "update single \(newValue)" ) | ||
|
||
return newValue | ||
} | ||
|
||
func update<T>( channel: Channel<[T]>, newValue: Any ) throws -> Any { | ||
print( "update array \(newValue)" ) | ||
|
||
return newValue | ||
} | ||
|
||
|
||
let channel = Channel(value: [ "1", "2", "3" ]) | ||
|
||
try update(channel: channel, newValue: []) | ||
|
||
let channel1 = Channel(value: "BBBBB") | ||
|
||
try update(channel: channel1, newValue: "CCCCC") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<playground version='5.0' target-platform='ios' buildActiveScheme='true' importAppTypes='true'> | ||
<timeline fileName='timeline.xctimeline'/> | ||
</playground> |