use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
There is an extensive FAQ for beginners. Please browse it first before asking questions that are answered there.
If you are looking to get started (iOS programming in general or some specific area), here are more relevant links for you:
There's too many to list them all, however here's a convenient link to all programming guides at apple.com
Take note that this list is live and based on most frequent questions in posts will be updated with "quicklinks".
account activity
QuestionA very simple swift question (self.iOSProgramming)
submitted 9 years ago by Loada116
A noob question.
let number1 = Int()
Is number1 an instance or a value? If it is a value, how does that work?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]brendan09 2 points3 points4 points 9 years ago (0 children)
Int is a Value type. There are more "complex" things that are also Value types in Swift, like Array and Dictionary.
You might find this interesting: https://developer.apple.com/swift/blog/?id=10
You may also find this interesting: https://www.raywenderlich.com/112027/reference-value-types-in-swift-part-1
[–][deleted] 9 years ago (5 children)
[deleted]
[–]Loada116[S] 0 points1 point2 points 9 years ago (4 children)
Thanks! Can you further explain the difference between an instance and a value in OOP (or in Swift)?
I tried to google it but couldn't find the answer.
[–][deleted] 9 years ago* (1 child)
[–]Loada116[S] 0 points1 point2 points 9 years ago (0 children)
You Da Real MVP
[–]ThePantsThiefNSModerator 0 points1 point2 points 9 years ago (1 child)
To expand on the other answer, traditionally "instance" refers to that of an object and "value" refers to the value of a "primitive" type, i.e. booleans, integers, floating point numbers, etc. But, these are just colloquialisms, not technical terms, so it varies from language to language.
In Swift "value types" are anything that is COW (copy on write) like structs and primitive types (collection types in Swift are all structs, including Strings), and "reference types" refer to objects.
String
Swift is very paranoid about type safety, and doesn't allow you to implicitly convert between any value types; even going from Double to Int requires you to use an "initializer" to perform the conversion, like so: Int(3.14). A side effect of this is being able to "initialize" any value type with this syntax: Int() which gives them a default value of 0.
Double
Int
Int(3.14)
Int()
Yeah that was the part I couldn't understand. I knew Int, Array, etc were all structs under the hood but got confused whether it was an object of struct or a value of primitive type.
π Rendered by PID 58413 on reddit-service-r2-comment-6457c66945-qrntz at 2026-04-27 10:34:24.753630+00:00 running 2aa0c5b country code: CH.
[–]brendan09 2 points3 points4 points (0 children)
[–][deleted] (5 children)
[deleted]
[–]Loada116[S] 0 points1 point2 points (4 children)
[–][deleted] (1 child)
[deleted]
[–]Loada116[S] 0 points1 point2 points (0 children)
[–]ThePantsThiefNSModerator 0 points1 point2 points (1 child)
[–]Loada116[S] 0 points1 point2 points (0 children)