Questions tagged [swift4.1]

Use this tag only for questions directly related to changes in version 4.1 of Apple's Swift programming language. Use the tag [swift] for more general language questions, or the tags [ios], [cocoa], [apple-watch] etc. for questions about developing on Apple platforms.

Swift 4.1 contains updates to the core language, including more support for generics, new build options, as well as minor enhancements to Swift Package Manager and Foundation. There was also significant progress made in stabilizing the ABI.

Swift 4 is the fourth version of the Swift language developed by Apple that was released in 2017. The language is open source and available on Github (see ).

The development of Swift 4 and its goals can be viewed on the Swift Programming Language Evolution repository on GitHub

229 questions
6
votes
1 answer

Thread 1: EXC_BAD_ACCESS (code=1, address=0x40)

I am running a code with webRTC. I am not posting code because I really don't know the point where it is getting crashed. It is almost thousands of lines of code. I want to know where exactly the code is crashing. Is there any tool or any way to…
MacDeveloper
  • 1,334
  • 3
  • 16
  • 49
6
votes
1 answer

Swift 4.1 Failed to get a bitmap representation of this NSImage

This code sample was working in a macOS playground: import Cocoa import XCPlayground func getResImg(name: String, ext: String) -> CIImage { guard let fileURL = Bundle.main.url(forResource: name, withExtension: ext) else { fatalError("can't…
Fritz
  • 95
  • 7
6
votes
1 answer

Error : Variable used within its own initial value with type(of:) function

In Swift standard document by Apple : func printInfo(_ value: Any) { let type = type(of: value) print("'\(value)' of type '\(type)'") } and it give an error : Variable used within its own initial value How can I fix this with Swift 4.1?
quangkid
  • 1,287
  • 1
  • 12
  • 31
6
votes
2 answers

How do I rotate a SpriteNode with a one finger “touch and drag”

How do I rotate a SpriteNode with a one finger “touch and drag” so that: It doesn’t jerk around It moves in a circle (I’ve successfully accomplished this part several times- both with a code only solution and with an SKS file) It produces a…
William Chadwick
  • 134
  • 2
  • 15
5
votes
5 answers

Call a method with dynamic class name in swift

How can we call class functions with a dynamic class name? Assume the following example where I have two class with methods with same signature class Foo{ class func doSomething() } class Foobar { class func doSomething() } class…
Vkharb
  • 856
  • 11
  • 19
5
votes
1 answer

UILabel text color is not changing programmatically, if I set the text color in nib and define that color in assets

The issues is cause by setting a custom color in the storyboard,its not related to custom font. Step 1: Define color in Assets Folder Step 2: Set that color as label text color Step 3: Change the text color in code Label background color is…
Imran
  • 3,045
  • 2
  • 22
  • 33
5
votes
1 answer

Can not conform to protocol by creating extension with Where Clauses

protocol Typographable { func setTypography(_ typography: Typography) } extension UILabel: Typographable {} extension Typographable where Self == UILabel { func setTypography(_ typography: Typography) { self.font =…
JIE WANG
  • 1,875
  • 1
  • 17
  • 27
5
votes
1 answer

Swift 4.1 deinitialize and deallocate(capacity:) deprecated

I've been saying this to form a C array of CGPoint: let arr = UnsafeMutablePointer.allocate(capacity:4) defer { arr.deinitialize() arr.deallocate(capacity:4) } arr[0] = CGPoint(x:0,y:0) arr[1] = CGPoint(x:50,y:50) arr[2] =…
matt
  • 515,959
  • 87
  • 875
  • 1,141
4
votes
4 answers

Concatenate Int like String in Swift?

I need Something like var a = 1 var b = 2 var c = a + b should be 12 (Int) instead of 3. var a = 12 var b = 34 var c = a + b should be 1234 (Int) instead of 46. I am not figuring out how can we do this for any number? One way is to convert two…
Jigar
  • 305
  • 2
  • 14
4
votes
1 answer

Swift 4.1.2 Autocomplete: Suggesting extensions on Array that it shouldn't

Maybe I'm going crazy here, but extension Array where Element == String in Swift 4.1.2 is exposing its properties in Swift's autocomplete on types when it should not be there. For example, this extension: extension Array where Element == String { …
stef
  • 952
  • 10
  • 15
4
votes
2 answers

How to upload multiple images in multiple array of images using multipart in Alamofire?

I'm having a problem with uploading multiple images in multiple array of images using multipart in Alamofire. Can any one help me? Thanks in advance!! I am using the following code let fileParameters = ["array_1": images1Array, …
Himanshu Parashar
  • 478
  • 1
  • 6
  • 18
4
votes
2 answers

How to use Self for method return types in Swift?

This code produces Xcode error messages that lead you in a circle. Let's say I have a protocol called Marker and I'd like Markers to copy themselves. Here's a first guess... protocol Marker { func copy() -> Self } class Marker1 : Marker { …
Rob N
  • 15,024
  • 17
  • 92
  • 165
4
votes
2 answers

AudioKit Module compiled with Swift 4.0.3 cannot be imported in Swift 4.1

I have updated to Xcode 9.3 and Swift 4.1 and using AudioKit 4.1. Though I am getting this error when building. How would I update the modules to Swift 4.1?
uplearned.com
  • 3,393
  • 5
  • 44
  • 59
4
votes
3 answers

Eureka Forms broken after Swift 4.1 Update

I just updated to Swift 4.1 and Eureka Forms is broken. I am trying to fix it myself, but I am not sure where to start. Does any one know if the library authors have fixed this yet? I didn't see any issues posted about it. The errors I get are as…
Taylor Simpson
  • 940
  • 1
  • 10
  • 27
3
votes
3 answers

Cycle in dependencies between targets 'StoreApp' and 'NotificationContentExtension'; building could produce unreliable results

After updating Xcode 10.0 the following error occurs while building the project. Cycle in dependencies between targets 'StoreApp' and 'NotificationContentExtension'; building could produce unreliable results. Cycle path: StoreApp →…
1
2
3
15 16