Questions tagged [swift5]

Use this tag only for questions directly related to changes in version 5 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 5 is a version of the Swift language developed by Apple and was released March 26th, 2019 with Xcode 10.2. The language is open source and available on GitHub (see ).

Swift 5 follows and .

Swift 5 Release Notes for Xcode 10.2.

3158 questions
6
votes
3 answers

RPBroadcastSampleHandler any method not getting called

I want to implement screen sharing functionality like skype(when app is in background then also it will share screen of iPhone), and for that i am using broadcast extension. Here its my code in my viewcontroller.swift import UIKit import…
Govind Rakholiya
  • 427
  • 6
  • 24
6
votes
1 answer

Call a function from SwiftUI in UIHostingController

I have a swift UIHostingController which renders a SwiftUI. I call a function in view did appear which builds fine but doesn't create the intended output. class LoginView: UIHostingController { required init?(coder: NSCoder)…
Rs Graphics
  • 183
  • 3
  • 14
6
votes
2 answers

Observe changes on SwiftUI TextField

I am playing around with Swift UI. I created a table view (a List) containing all my desired elements. Also the TextField change is working when pressing enter on the keyboard. Nice to build so fast a table view ;). But now I want to track every…
rb90
  • 289
  • 1
  • 6
  • 19
6
votes
4 answers

iOS 13 SearchController Back Button Color

I have a strange visual bug in my app that only applies to iOS 13 running from an Xcode 11 build. I have a table view embedded in a Navigation Controller with the default tint color set to my app's primary orange color. On iOS12, when you cancel the…
eResourcesInc
  • 948
  • 1
  • 9
  • 17
6
votes
2 answers

UIViewController lifecycle broken iOS13, makeKeyAndVisible() seems not to operate?

I have a custom UIStoryboardSegue that works as desired in iOS12.*. One of the destination view controller is a UITabbarController: for each tab, I have a controller embedded in a navigation controller. Unfortunately, for iOS13.*, this does not work…
Stéphane de Luca
  • 12,745
  • 9
  • 57
  • 95
6
votes
2 answers

Swift 5.1 @propertyWrapper - 'self' used in property access before all stored properties are initialized

I am trying to use Swift 5.1 property wrappers but every time I think I have a cool use case for it, I eventually hit the problem where I can't use them inside of my View Model's initializer. Take this extremely simple example. class NoProblem { …
Kevin Renskers
  • 5,156
  • 4
  • 47
  • 95
6
votes
1 answer

UICollectionViewLayout with dynamic heights - but NOT using a flow layout

Say you have a UICollectionView with a normal custom UICollectionViewLayout. So that is >>> NOT <<< a flow layout - it's a normal custom layout. Custom layouts are trivial, in the prepare call you simply walk down the data and lay out each…
Fattie
  • 27,874
  • 70
  • 431
  • 719
6
votes
0 answers

iOS 13 UIBackgroundTaskIdentifier

Can't end BackgroundTask: no background task exists with identifier , or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug. self.backgroundTaskIdentifier =…
Ravikanth
  • 308
  • 1
  • 10
6
votes
2 answers

Change tabBar height in Swift 5 for IOS 13

I need to change the UITabBar height to 95. I can do that in the older version of iOS Swift. This is my code that work in the older version. override func viewWillLayoutSubviews() { super.viewWillLayoutSubviews() tabBar.frame.size.height =…
Fabio Cirruto
  • 71
  • 1
  • 7
6
votes
1 answer

New delegates for carPlay

I am devleoping navigation app for CarPlay and in iOS 12 there were two methods from CPApplicationDelegate to detect if CarPlay is on: func application(_ application: UIApplication, didConnectCarInterfaceController interfaceController:…
impresyjna
  • 61
  • 1
  • 2
6
votes
1 answer

Thread 1: EXC_BAD_ACCESS (code=1, address=0x48) - broken with iOS13.1 (dev build 2)

So, I updated my iPhone 6S to the second dev build of iOS13.1 yesterday and all of the sudden my app (which is on the app store with 0 crashes showing on the Connect app) doesn't work when run on my device. It does however work in Xcode's…
jammyman34
  • 1,399
  • 4
  • 15
  • 22
6
votes
2 answers

FunctionBuilder with 1 item

I'm trying to wrap my head around @_functionBuilder. There is one case I haven't been able to figure out. I put together this simple example, when there are two passengers this works great. But when there is only 1 I get this error: error:…
keegan3d
  • 10,357
  • 9
  • 53
  • 77
6
votes
0 answers

Slow iOS app start using Xcode 10.2 + iOS 12.2

I have a very strange issue seemingly caused by compiling with latest Xcode 10.2. I have noticed my app start time to get significantly worse (3x slower) caused simply by building using Xcode 10.2(.x) and running on iOS 12.2. The same code revision,…
Lukas Kukacka
  • 7,604
  • 2
  • 25
  • 50
6
votes
2 answers

Swift randomFloat issue: '4294967295' is not exactly representable as 'Float'

When generating a random CGFloat, I use the following code. Some explanation here extension CGFloat{ static func randomFloat(from:CGFloat, to:CGFloat) -> CGFloat { let randomValue: CGFloat = CGFloat(Float(arc4random()) / 0xFFFFFFFF) …
dengST30
  • 3,643
  • 24
  • 25
6
votes
1 answer

Why are IBOutlets optionals after swift 5 migration

After migrating the project to swift 5, I'm getting a lot of errors such as Expression implicitly coerced from 'UIButton?' to 'Any' I'm not sure what's causing this. One example where this is happening(there are a bunch) is when I'm setting the…
Jay
  • 2,591
  • 1
  • 16
  • 28