I have the following I want to achieve in Swift: I have a protocol protocol IdProtocol { static var id: Int { get } } Now I want each implemento ...
I have the following I want to achieve in Swift: I have a protocol protocol IdProtocol { static var id: Int { get } } Now I want each implemento ...
I would like to ask if it's possible to extend functions or have some way to use them like this. Because I don't want to open task closure for every a ...
I have a enum that has an integer representation, and I am going to be iterating over this type in a for loop. I was loop to get both the min and max ...
Abstract The requirements of the app I'm working on make me use DateComponents as a bridge when working with time - specifically hours and minutes. A ...
I was having fun while practicing a Kata. I wanted to implement one of the functions in my solution as an extension of Int, because I liked the idea o ...
I have a class where some subclasses conform to Protocol1. The API from Protocol1 is sufficient to implement Protocol2. I want to do something like be ...
I'm learning the swift programming language and recently came across the concept of extensions, where you can extend the functionality of an existing ...
This is my first question to the StackOverflow community so excuse me if I'm doing something wrong. 1. What I'm trying to achieve Basically, I want t ...
Using Swift5.5, iOS15.0.1, As of iOS15, I realised that there are quite some deprecations going on in relation to my existing URL-extension. I didn' ...
does js/ts has something like impl in Rust or extension in Swift? this is a good pratice to implement method for object with a specific shape. and we ...
I am trying to style a Text Editor in SwiftUI to look like a Material Design element. Currently, I'm struggling with the floating label. I cannot figu ...
Circumstances The following class: and the following protocol: Intention Extend the protocol sharable in a way so that subclasses of User get ...
I am new to Swift and I am trying to understand how could a class get a value inside an extension. I have two problems but they are similar to each o ...
I'm trying to create an extension on Set that uses a where clause so that it only works on a struct I have that accepts a generic. But I keep running ...
I was trying to add a timer property in an extension. The code is as follow @objc public extension RCTTouchHandler { static let kSessionTimer = "s ...
I like to separate soms function and var from a enum and thought this was a way. (Just sample code) This results in a compile error "Type 'Self' has n ...
I am trying to setup a success/error view on a controller via protocol and extensions. What I want to achieve is that I want to get into the state wh ...
I had created extension : I am trying to use extension in uitableviewcell class : I want to fetch section and row for index in uitableviewcell. ...
Consider the following situation: If there is no associatedtype, the expression (self as P).f() is OK. Is there a method to reuse P.f() when P has ...
Overview I'm trying to better understand how extensions work. In my app I have a ViewController. There I put a view of another class. In this custom c ...