{infiniteZest}
// Articles. Tutorials. Utilities.
Home  |   Search  |   Login  
Categories Skip Navigation Links
New / All
AJAX
Apple
ASP.NET
.NET
Git
Google / Android
Python / IronPython
Miscellaneous
SQL Server
Test: Swift - Type Aliases

4. String has a nested type CharacterView, and it has a nested type Index. How can you alias the Index type?



Results
Congratulations! Correct Answer.
You Answered: None. If you took the test, your answer will show up here.
Correct Answer: typealias StringIndex = String.CharacterView.Index
Explanation
Accessing the Index type which is inside CharacterView, which happens to be inside String, will require specifying the full path to that type (in this case, they all are structs). So, the correct statement would be typealias StringIndex = String.CharacterView.Index
Take the Test
Take the complete test on this topic. You will be able to review answers to questions and get a test score.

Take the Test


Question 4 of 5


Test is Based on this Article
icon-swift-article.jpg
Tags: typealias, types
This article talks about using a different name to refer to a type, by using typealias.
icon-swift-test.jpg
Tags: typealias, types
Test on using Type Aliases in Swift.

More Articles With Similar Tags
icon-swift-test.jpg
Tags: typealias, types
Test on using Type Aliases in Swift.
icon-swift-article.jpg
Tags: bool, types, swift
This article discusses the boolean types in Swift and contrasts with how these types are used in C and Objective-C.
icon-swift-test.jpg
Tags: bool, types, swift
Test on Boolean Types in Swift.
icon-swift-article.jpg
Tags: int, types, swift
This article goes through the usage of various integer types in Swift (including Int and UInt).
icon-swift-test.jpg
Tags: int, types, swift
Test on Integer types in Swift.
                                                                                                                                                                                                             
About  Contact  Privacy Policy  Site Map