Your first attempt won’t work because C structs don’t exist in Swift. You need:
let size = CGSize(width: 20, height: 30)
Or (before Swift 3 only, and even then, not preferred):
let size = CGSizeMake(20,30)
(Not MakeSize).
Related Contents:
- How to provide a localized description with an Error type in Swift?
- ReactiveCocoa vs RxSwift – pros and cons?
- How do I get the count of a Swift enum?
- SwiftUI: How to implement a custom init with @Binding variables
- Wait until swift for loop with asynchronous network requests finishes executing
- Swift make method parameter mutable?
- Get integer value from string in swift
- Swift: how to use PREPROCESSOR Flags (like `#if DEBUG`) to implement API keys?
- Remove all non-numeric characters from a string in swift
- Disable a Button
- How to remove a key-value pair from swift dictionary?
- Getting “file not found” in Bridging Header when importing Objective-C frameworks into Swift project
- What enables SwiftUI’s DSL?
- How to create an array with incremented values in Swift? [duplicate]
- SwiftUI dismiss modal
- Is there a way to set associated objects in Swift?
- UIApplication.shared.delegate equivalent for SceneDelegate xcode11?
- How to Make the scroll of a TableView inside ScrollView behave naturally
- How to generate a random number in Swift?
- How to do an if-else comparison on enums with arguments [duplicate]
- SwiftUI – Half modal?
- ‘requestReview()’ was deprecated in iOS 14.0
- Cancel a timed event in Swift?
- Does Swift implement tail call optimization? and in mutual recursion case?
- Custom Swift Encoder/Decoder for the Strings Resource Format
- How to update Swift dependencies in Xcode
- How to unwrap an optional value from Any type?
- Swift equivalent of Array.componentsJoinedByString?
- Swift: How to use sizeof?
- How do I put different types in a dictionary in the Swift Language?
- What does the dollar sign do in Swift / SwiftUI?
- How to create local scopes in Swift?
- What is the best way to determine if a string contains a character from a set in Swift
- How to convert AnyClass to a specific Class and init it dynamically in Swift?
- SwiftUI preview provider with binding variables
- Generic Swift 4 enum with Void associated type
- How to remove “row” separators/dividers from a List in SwiftUI?
- How can I read a file in a swift playground
- Using an NSTimer in Swift
- ‘An NSManagedObject of class ‘className’ must have a valid NSEntityDescription.’ error
- How to declare a ‘protected’ variable in swift
- Does Swift have a null coalescing operator and if not, what is an example of a custom operator?
- Using “if let” with logical “or” operator
- Xcode: Using custom fonts inside Dynamic framework
- How to use openURL for making a phone call in Swift?
- Casting from ‘NSPersistentStoreResult’ to unrelated type ‘Entity’ always fails
- Is there a writeToFile equivalent for Swift 3’s ‘Data’ type?
- How can I make a Swift enum with UIColor value?
- When should I use deinit?
- Xcode Ignoring import