Mobile Development Swift Subjective
Oct 04, 2025

What are the basic data types in Swift?

Detailed Explanation
Swift provides several fundamental data types for different kinds of values.\n\n• **Numeric Types:**\n• Int - Integer values (32-bit or 64-bit)\n• Double - 64-bit floating-point numbers\n• Float - 32-bit floating-point numbers\n• UInt - Unsigned integers\n\n• **Text Types:**\n• String - Text data with Unicode support\n• Character - Single Unicode character\n\n• **Boolean Type:**\n• Bool - true or false values\n\n• **Collection Types:**\n• Array - Ordered collection of values\n• Set - Unordered collection of unique values\n• Dictionary - Key-value pairs\n\n• **Optional Types:**\n• Optional - Values that can be nil\n\n**Examples:**\n\nlet age: Int = 25\nlet price: Double = 99.99\nlet name: String = "Swift"\nlet isActive: Bool = true\nlet numbers: [Int] = [1, 2, 3]\nlet optionalValue: String? = nil\n
Discussion (0)

No comments yet. Be the first to share your thoughts!

Share Your Thoughts
Feedback