[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/swift general/
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 24
Thread images: 2
>>
Well? Is it good?
>>
>>51321017
how to open the webcam
>>
>>51321017
/thread
>>
>>51321049
What do you mean
>Well? Is it good?

It's arguably one of the best programming languages out there right now. It tops Python, C#, and C. It's the coding language of te future, it's not the stone age anymore. People moved on from tape drives, it's time to move onto modern programming languages too.
>>
When will it be available on Loonix?
>>
>>51321075
>People moved on from tape drives
But they haven't if they need to backup large amounts of data.
>>
>>51321084
when linux becomes relevant

never
>>
>>51321049
emphasise on >>51321049
its an awesome language. Maybe it won't top C in terms of system optimization. But when it goes Open Source, it'll be by far the best language.

>>51321084
it already is. it's just not open source yet. some company made a port. It's not too usable atm though
>>
>>51321049
it's strongly typed, yet it has powerful type inference, meaning you write less code. whether you think that's a good thing or not is subjective. personally i think it feels more modern than explicitly declaring types and stuff.

memory management is handled by reference counting, and naturally everything goes on the heap. it's for this reason that i don't believe it could ever be as fast as Rust because rust sets cues for memory management at compile time and defaults to the stack. however, you cant' write apple apps in rust, and it does compile to faster code than objective-c.

that's kinda all i've got so far after a week of using it
>>
>>51321084
they said December 2015 didn't they?
>>
>>51321107
how can someone be such a tech illiterate on /g/
>>
>>51321161
probably for the same reasons you're posting in /swift genera/ without talking about programming. they just wanna feel included, even though they aren't in like-minded company
>>
>>51321178
nah i just posted to shit on them, anon
>>
>>51321055
literally
hello, Swift. Please: webcam.open()

no semicolons or anything. a common n00b mistake is typing the semicolon (;) in swift
>>
 = 
PERFECTLY VALID SWIFT
>>
File: perfectly valid swift code.jpg (421 KB, 2650x1634) Image search: [Google]
perfectly valid swift code.jpg
421 KB, 2650x1634
>>51321017
>>
>>51321161
most retarded comment I've read all day

linux is garbage, get out neet
>>
>>51321441
yeah, sure is crap. did you form that opinion after using the language or before?

import UIKit

class ViewController: UIViewController {

@IBOutlet weak var display: UILabel!

var userIsInTheMiddleOfTypingANumber = false


@IBAction func appendDigit(sender: UIButton) {
let digit = sender.currentTitle!
if userIsInTheMiddleOfTypingANumber {
display.text = display.text! + digit
} else {
display.text = digit
userIsInTheMiddleOfTypingANumber = true
}

}

@IBAction func operate(sender: UIButton) {
let operation = sender.currentTitle!
if userIsInTheMiddleOfTypingANumber {
enter()
}
switch operation {
// pass closures as functions. NOTICE the type inference from
// func performOperation

//the fact that swift automatically assigns function arguments into an array, you do not even need to specify the variable name, or the type. only need to decalare the function logic
case "×": performOperation { $0 * $1 }
case "÷": performOperation { $1 / $0 }
case "-": performOperation { $1 - $0 }
case "+": performOperation { $0 + $1 }
default: break
}
}

//perform operation is a function that can take functions as args and returns a double
func performOperation(operation: (Double, Double) -> Double) {


}

var operandStack = Array<Double>()

@IBAction func enter() {
userIsInTheMiddleOfTypingANumber = false
operandStack.append(displayValue)
print("operand stack is \(operandStack)")
}

var displayValue: Double {
get {
return (NSNumberFormatter().numberFromString(display.text!)!.doubleValue)
}
set {
display.text = "\(newValue)"
userIsInTheMiddleOfTypingANumber = false
}
}

}
>>
>>51322001
Nice fart app.
>>
>>51322076
run it yourself, if you aren't scared
>>
>>51322001
> //the fact that swift automatically assigns function arguments into an array, you do not even need to specify the variable name, or the type. only need to decalare the function logic
So it's like bash?
>>
>>51322631
sorta, but that could be an over simplification, or an understatement
>>
>>51322631
functions are just types in Swift. they're no different than string
Thread replies: 24
Thread images: 2

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.