Skip to content

Instantly share code, notes, and snippets.

View SwiftBeta's full-sized avatar
💻

SwiftBeta SwiftBeta

💻
View GitHub Profile
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView {
SidebarView()
DetailSplitView(number: 1, color: .red)
}
}
}
class ViewController: UIViewController {
private let swiftBetaButton1: UIButton = {
var configuration = UIButton.Configuration.filled() // 1
configuration.title = "Suscríbete a SwiftBeta" // 2
configuration.subtitle = "Apoya el canal" // 3
configuration.image = UIImage(systemName: "play.circle.fill") // 4
let button = UIButton(type: .system) // 5
button.translatesAutoresizingMaskIntoConstraints = false // 6
button.configuration = configuration // 7
var names = ["SwiftBeta", "Swift"]
var fruits = ["apple", "orange"]
print(Array(zip(names, fruits)))
import UIKit
let urlSessionConfiguration = URLSessionConfiguration.default
let urlSession = URLSession(configuration: urlSessionConfiguration)
let session = URLSession.shared
let url = URL(string: "https://itunes.apple.com/search/media=music&entity=song&term=avicii")
urlSession.dataTask(with: url!) { data, response, error in
print("Data \(String(describing: data))")
print("Response \(String(describing: response))")
let values = ["SwiftBeta", "Swift", "SwiftUI"].publisher
values.sink { value in
print(value)
}
import UIKit
class User {
var name: String
init(name: String) {
self.name = name
}
}
import UIKit
struct User {
var name: String
}
var user = User(name: "Steve")
var copyUser = user
copyUser.name = "Tim"
func multiply() -> (Int) -> Int {
return { value in
return value * 2
}
}
print(multiply()(4))
func add(number: Int) -> (Int) -> Int {
return { value in
return value + 2
}
}
let type = add(number:)
func add(number: Int) -> (Int) -> Int {
return { value in
return value + 2
}
}
let type = add(number: 2)