Top "Swift-extensions" questions

Extensions add new functionality to an existing class, structure, or enumeration type.

Swift Extension: same extension function in two Modules

Say I have a Framework called SwiftKit, which has a UIView's extension class method named someClassMethod and a property named …

swift namespaces swift-extensions
Swift extension of a class ONLY when it conforms to a specific protocol

Hi there =) I was just faced with a design problem where I need to (essentially) do the following: I want …

ios swift uiviewcontroller swift-protocols swift-extensions
How to use @objc protocol with optional and extensions at the same time?

This code does not compile and might sound stupid as it is, but i'll explain why it's so important! @objc …

ios objective-c swift protocols swift-extensions
Why can't extensions with protocol conformances have a specific access level?

Assume we have the following example code: protocol MyProtocol { func someFunction() } public class MyClass { } public extension MyClass: MyProtocol { func someFunction() { …

swift protocols swift-extensions access-levels
Extension may not contain stored property but why is static allowed

Extension cannot contain stored property, but why then can static stored property be defined within extension? I also didn't find …

swift swift-extensions
Swift map(_:) extension for Set() ?

let numberSet = Set(1...11) let divideSet = numberSet.map({ $0 / 10 }) //Error: Set does not have a member named map :( Swift 1.2 supports Set() for …

swift swift-extensions
Accessing Obj-C properties in Swift extension file

I started writing Swift extensions on my view controllers. So I have three files right now: My header file, ViewController.…

objective-c swift swift-extensions