swift3

Ambiguous reference to member Swift 3

人盡茶涼 提交于 2020-03-13 06:04:06
问题 I am migrating my project from Swift 2.3 to Swift 3. And having difficulty as expected. Here is a function which is being used for OAuth, using OAuthSwift. I have tried to convert class func OAuthSwiftAuthorization(inViewController viewController: UIViewController, withOAuthInfo info:FitnessTracker, successHandler:@escaping MyOAuthNewSuccessHandler, failure: @escaping ((_ error: NSError) -> Void)) { let oauthswift = OAuth2Swift( consumerKey: info.consumerKey, consumerSecret: info

Swift 3 | Unable to hide status bar on a ViewController

旧城冷巷雨未停 提交于 2020-03-06 00:59:29
问题 I want to show the status bar on portrait mode only, when I rotate the screen the status bar hides as intended but if I push / show a new View Controller the status bar appears again. I've tried the following without success: Setting View controller-based status bar appearance to NO in the info.plist file Using setNeedsStatusBarAppearanceUpdate() on self and on NavigationController Setting prefersStatusBarHidden: Bool to true Also tried UIApplication.shared.setStatusBarHidden(true, with:

Fullscreen for Swift Playgrounds on iPad

别来无恙 提交于 2020-02-28 04:03:41
问题 Trying to create a Swift playground on the iPad that will display in full screen. I have tried obtaining the bounds of the screen using UIScreen.main().bounds , but the display just becomes too large for the default playgrounds frame. I know that this is possible because all of the example playgrounds are fullscreen. I just can't figure out how it is being done. Update 1: Here is a photo. I want the white frame to take up the entire screen. 回答1: Each ".playgroundpage" folder has a Manifest

Swift conversion: ERROR - UnsafeMutablePointer

那年仲夏 提交于 2020-02-25 04:45:26
问题 I am attempting to convert my Swift 2 code into the latest syntax(Swift 3). I am receiving the following error: Cannot invoke initializer for type 'UnsafeMutablePointer<CUnsignedChar>' with an argument list of type '(UnsafeMutableRawPointer!) Swift 2 Code: let rawData = UnsafeMutablePointer<CUnsignedChar>(calloc(height * width * 4, Int(sizeof(CUnsignedChar)))) Can someone please help me resolve this conversion syntax issue? 回答1: calloc returns a "raw pointer" (the Swift equivalent of void *

Swift conversion: ERROR - UnsafeMutablePointer

北城以北 提交于 2020-02-25 04:45:09
问题 I am attempting to convert my Swift 2 code into the latest syntax(Swift 3). I am receiving the following error: Cannot invoke initializer for type 'UnsafeMutablePointer<CUnsignedChar>' with an argument list of type '(UnsafeMutableRawPointer!) Swift 2 Code: let rawData = UnsafeMutablePointer<CUnsignedChar>(calloc(height * width * 4, Int(sizeof(CUnsignedChar)))) Can someone please help me resolve this conversion syntax issue? 回答1: calloc returns a "raw pointer" (the Swift equivalent of void *

Swift 3: How to reverse a transparent Navigation Bar?

瘦欲@ 提交于 2020-02-24 09:25:08
问题 I'm trying to create a twitter app, emulating the real app, using the twitter API. On the timeline view, I have a regular navigation bar, and when a user taps a user profile, the profile view has a transparent bar so that the user's banner image can be displayed. I used the following code to make the navigation bar transparent in the user profile view: self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) self.navigationController?.navigationBar.shadowImage =

Exception when pausing voice over

梦想的初衷 提交于 2020-02-24 00:41:07
问题 I try to pause voice over and get an exception: UIAccessibilityPostNotification(UIAccessibilityPauseAssistiveTechnologyNotification, UIAccessibilityNotificationVoiceOverIdentifier) 'NSInvalidArgumentException', reason: 'You must pass the identifier of the assistive technology to pause. See UIAccessibilityConstants.h for the list of valid values.' What's wrong? Thanks! 回答1: You must use an UIAccessibility.AssistiveTechnologyIdentifier like: UIAccessibility.post(notification:

Exception when pausing voice over

时光毁灭记忆、已成空白 提交于 2020-02-24 00:38:25
问题 I try to pause voice over and get an exception: UIAccessibilityPostNotification(UIAccessibilityPauseAssistiveTechnologyNotification, UIAccessibilityNotificationVoiceOverIdentifier) 'NSInvalidArgumentException', reason: 'You must pass the identifier of the assistive technology to pause. See UIAccessibilityConstants.h for the list of valid values.' What's wrong? Thanks! 回答1: You must use an UIAccessibility.AssistiveTechnologyIdentifier like: UIAccessibility.post(notification:

ios UIImage going outside of UIImageView Border

非 Y 不嫁゛ 提交于 2020-02-22 18:47:07
问题 Here black border shows the Parent UIView of UIImageView and Red border showing UIImageView i'm downloading image from server but the image is going outside of the UIImageView area as shown in the image. I'm doing it programmatically any help would be very much appreciated. I'm adding code block below let bottomView : UIView = UIView(frame: CGRect(x : 10, y: stackView.height, width: view.width * 0.75, height: view.width * 0.75 )) view.addSubview(bottomView) bottomView.layer.borderColor =

reserved keyword ExpressionAttributeValues in DynamoDB using Swift 3

家住魔仙堡 提交于 2020-02-22 05:29:54
问题 I am able to get a response without the :status : accept expression attribute value but with it, I get the following error when I am using the #status in the projectionExpression line (status is a reserved word in DynamoDB so I had to add hashtag there per https://stackoverflow.com/a/45952329/5921575): Error Domain=com.amazonaws.AWSCognitoIdentityErrorDomain Code=0 "(null)" UserInfo={__type=com.amazon.coral.validate#ValidationException, message=Value provided in ExpressionAttributeValues