Swift (linguaggio di programmazione): differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
Traduzione |
m →Maiuscolo e minuscolo: fix |
||
(29 versioni intermedie di 16 utenti non mostrate) | |||
Riga 5:
| autore = [[Apple Inc.]]
| data = 9 settembre 2014
| versione =
| utilizzo = [[General purpose]]
| paradigmi = [[Paradigma di programmazione|Multiparadigma]]
Riga 17:
| licenza = [[Licenza Apache|Apache]] 2.0
}}
'''Swift''' (dall'[[Lingua inglese|inglese]] "rapido, svelto") è un linguaggio di [[programmazione orientata agli oggetti|programmazione orientato agli oggetti]] per sistemi [[macOS]], [[iPadOS]], [[iOS]], [[watchOS]], [[tvOS]] e [[Linux]], presentato da [[Apple]] durante la WWDC 2014.<ref>{{Cita web|url=https://www.cbsnews.com/news/wwdc-2014-iphone-ipad-updates-smart-home-system-and-more/|titolo=Apple WWDC 2014: iPhone, iPad updates, "smart home" system and more|editore=CBS News|data=2 giugno 2014|accesso=3 giugno 2014|lingua=en}}</ref>
Il 25 marzo
▲Il 25 marzo [[2019]] è stata pubblicata la versione 5.0 sotto licenza [[open source]] [[Licenza Apache|Apache]] 2.0 per sistemi [[Apple]] e [[Linux]].<ref>{{Cita pubblicazione|data=2019-04-01|titolo=The Swift Programming Language. Contribute to apple/swift development by creating an account on GitHub|editore=Apple|accesso=2019-04-01|url=https://github.com/apple/swift}}</ref>
== Storia ==
Lo sviluppo di Swift è iniziato nel
Al WWDC del 2 giugno
Al keynote dell'8 giugno
Il 13 settembre
== Cronologia delle versioni ==
Riga 96 ⟶ 93:
| 5.1
| style="text-align:right" | 10 settembre 2019
| style="text-align:left" | <ref>{{Cita web |url = https://swift.org/blog/swift-5-1-released/ |titolo = Swift.org - Swift 5.1 Released! |
|-
| 5.2
| style="text-align:right" | 24 marzo 2020
| style="text-align:left" | <ref>{{Cita web |url = https://swift.org/blog/swift-5-2-released/ |titolo = Swift.org - Swift 5.2 Released! |
|-
| 5.3
| style="text-align:right" | 16 settembre 2020
| style="text-align:left" | <ref>{{Cita web |url = https://swift.org/blog/swift-5-3-released/ |titolo = Swift.org - Swift 5.3 Released! |
|-
| 5.4
| style="text-align:right" | 26 aprile 2021
| style="text-align:left" | <ref>{{Cita web |url = https://swift.org/blog/swift-5-4-released/ |titolo = Swift.org - Swift 5.4 Released! |
|-
| 5.5
| style="text-align:right" | 20 settembre 2021
| style="text-align:left" | <ref>{{Cita web |url = https://swift.org/blog/swift-5-5-released/ |titolo = Swift.org - Swift 5.5 Released! |
|-
| 5.6
| style="text-align:right" | 14 marzo 2022
| style="text-align:left" | <ref>{{Cita web|url = https://swift.org/blog/swift-5.6-released/ |titolo = Swift.org - Swift 5.6 Released! | accesso = 20/09/2021|lingua=en }}</ref>
|-
| 5.7
| style="background-color:#D4F4B4" | 5.6▼
| style="
| style="
|-
| 5.8
| style="text-align:right" | 30 marzo 2023
| style="text-align:left" | <ref>{{Cita web|url = https://swift.org/blog/swift-5.8-released/ |titolo = Swift.org - Swift 5.8 Released! | accesso = 07/04/2021|lingua=en }}</ref>
|-
| 5.9
| text-align:right" | 18 settembre 2023
| style="text-align:left" | <ref>{{Cita web|url = https://www.swift.org/blog/swift-5.9-released/ |titolo = Swift.org - Swift 5.9 Released! | accesso = 26/09/2023|lingua=en }}</ref>
|-
| 5.10
| style="text-align:right" | 5 marzo 2024
| style="text-align:left" | <ref>{{Cita web|url = https://www.swift.org/blog/swift-5.10-released/ |titolo = Swift.org - Swift 5.20 Released! | accesso = 05/03/2024|lingua=en }}</ref>
|-
| style="background-color:#D4F4B4; text-align:right" | 17 settembre 2024
| style="background-color:#D4F4B4; text-align:left" | <ref>{{Cita web|url = https://www.swift.org/blog/announcing-swift-6/ |titolo = Swift.org - Announcing Swift 6 | accesso = 17/09/2024|lingua=en }}</ref>
|}
Riga 125 ⟶ 141:
=== Hello, world! ===
[[Hello world|Hello, world!]] è il classico programma che scrive in output "''Hello, world!''".<syntaxhighlight lang="swift">
import
print("Hello, world!")
Riga 132 ⟶ 148:
==== Analisi ====
<syntaxhighlight lang="swift">
import
</syntaxhighlight>La funzione "'''import'''" importa nel programma determinati metodi o classi che permettono a quest'ultimo di implementare determinati comandi.
"'''
print("Hello,
</syntaxhighlight>La funzione "'''print'''" permette di mostrare a schermo ciò che viene scritto tra le virgolette dentro le parentesi tonde.
Riga 147 ⟶ 163:
<syntaxhighlight lang="swift" line="1">
// Dichiara le variabili da utilizzare
var nome = "Mario", cognome = "
// Converti la stringa in maiuscolo
Riga 163 ⟶ 179:
<syntaxhighlight lang="swift">
import
// Dichiara le variabili da utilizzare
Riga 176 ⟶ 192:
<syntaxhighlight lang="swift">
import
// Dichiara le variabili da utilizzare
Riga 235 ⟶ 251:
var età = 46
</syntaxhighlight>
*
* Le parentesi tonde () per racchiudere condizioni di confronti (if-else, switch...) e cicli (for in, do-while...) sono facoltative;
* Il punto e virgola ";" a fine istruzione, anch'esso è facoltativo;
<syntaxhighlight lang="swift">
// Con dichiarazione
let a: (String) = "A";
Riga 245 ⟶ 261:
let b: String = "B"
// Senza nemmeno la dichiarazione
let c = "C"
</syntaxhighlight>
Riga 257 ⟶ 273:
== SwiftUI ==
{{vedi anche|SwiftUI}}
'''SwiftUI''' è un framework di sviluppo realizzato da [[Apple Inc.]] e scritto interamente in Swift.
Presentato nel WWDC 2019, SwiftUI è stato pensato per costruire interfacce utente tramite un unico set di tool e API che coinvolge tutto l'ecosistema Apple (precedentemente si faceva uso di frameworks distinti: [[AppKit]] per [[macOS]], [[UIKit]] per [[iOS]] e [[WatchKit]] per [[watchOS]]).
== Note ==
|