swift4.2

reset view rotation angle to zero in swift ios

断了今生、忘了曾经 提交于 2019-12-25 00:53:02
问题 I'm able to rotate UIView by 90 degree and also able to get rotation angle. Need to implement--->reset myView rotation angle value to 0 but view position/direction should not go previous rotation/position value on UI and then if i rotate it has to start rotate from same position/direction and it's rotation angle need to start from 0. I rotated view 90 degree by tapping on rotate button as below screen. Here is the implementation code @IBOutlet weak var myView: UIView! @IBAction func rotateBtn

How to fix this error “ Could not find module 'CzsBleSdk' for architecture 'x86_64'; found: arm64, arm ”

僤鯓⒐⒋嵵緔 提交于 2019-12-24 12:42:13
问题 I'm working with bluetooth in an old project which was written in swift3 and i'm working on converting it in swift4 and I had this error "Could not find module 'CzsBleSdk' for architecture 'x86_64'; found: arm64, arm" 回答1: You are now using 64 bit architecture in your Swift 4 project. You'll need the latest CzsBleSdk SDK which supports 64-bit architecture. You can integrate that manually or using Pod. I personally recommend Pod. 回答2: I seems that your framework was built and published the

How to fix “Expression type '@lvalue CGRect/CGSize' is ambiguous without more context”?

南楼画角 提交于 2019-12-23 06:24:08
问题 I have an existing codebase that was written in Swift 3 and Xcode 9 that I am having trouble migrating to Xcode 10 and Swift 4.2 due to build errors within the code. The problem I am running into now is this: "Expression type '@lvalue CGRect' is ambiguous without more context" I am getting this error in 3 different areas of my code. The fourth one is related but different in that it says: "Expression type '(CGSize) -> CGSize' is ambiguous without more context" I have tried changing all values

Initiating a firebase-function with PayPal

只谈情不闲聊 提交于 2019-12-20 05:58:38
问题 I am having a problem passing my data from my firebase-function to PayPal. When I run the following code, the logs in firebase-functions receives it but it is not getting to PayPal: let url = NSURL(string: "https://us-central1-ryyde-sj.cloudfunctions.net/payout") let postParams: [String : Any] = ["uid": FIRAuth.auth()?.currentUser?.uid as Any, "email": txtPayoutEmail.text as Any] let request = NSMutableURLRequest(url: url! as URL) request.httpMethod = "POST" request.addValue("application/json

Using '!' here is deprecated and will be removed in a future release - swift 4.2

大城市里の小女人 提交于 2019-12-17 21:29:19
问题 Compiler throwing following warning when setting image in a cell using SDWebimage in Swift 4.2. Swift Compiler warning : Using '!' here is deprecated and will be removed in a future release let url = NSURL(string: (str_url) as String) cell.img!.sd_setImage(with: url as URL!, completed: block_image) //--- WARNING ON THIS LINE AT URL! Any Suggestions ? 回答1: Use this code : cell. img!.sd_setImage(with: url! as URL, completed: block_image) Suggestion: use URL instead of NSURL let url = URL(string

Type 'NSNotification.Name' has no member 'keyboardDidShowNotification'

落花浮王杯 提交于 2019-12-17 09:45:17
问题 I'm getting this error with Swift 4.2 Type 'NSNotification.Name' has no member 'keyboardDidShowNotification' Here is my code: NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardDidShow(notification:)), name: NSNotification.Name.keyboardDidShowNotification, object: nil) Following one was working fine with Swift 4 but not with Swift 4.2 NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardDidShow(notification:)), name: NSNotification.Name

Type 'NSNotification.Name' has no member 'keyboardDidShowNotification'

孤者浪人 提交于 2019-12-17 09:45:16
问题 I'm getting this error with Swift 4.2 Type 'NSNotification.Name' has no member 'keyboardDidShowNotification' Here is my code: NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardDidShow(notification:)), name: NSNotification.Name.keyboardDidShowNotification, object: nil) Following one was working fine with Swift 4 but not with Swift 4.2 NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardDidShow(notification:)), name: NSNotification.Name

UITableViewCell doesn't work unless I add views to a container view rather than contentView

浪子不回头ぞ 提交于 2019-12-13 18:09:05
问题 Background This is in reference to this post (TLDR; UITableViewCell heights should be calculated automatically if you are using Auto Layout properly). Problem If I add the views directly to contentView , I keep on getting this error: 018-11-25 02:17:33.514881+0200 [78571:855018] [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which

Classes in Swift files inside folder references not seen by Xcode 10's compiler

好久不见. 提交于 2019-12-13 03:36:02
问题 We have a project with nearly 1K Swift files. It just works well if everything is inside groups, but when trying to add some folder references to directories that contain Swift files, the compiler just can't see any thing defined inside these files (classes, for example). It works well for bundle and data files, but not for source code. I also tried changing existing groups to folders using different methods (dragging, using the menu and manually browsing, etc.) and XCode stops seeing the

Array of methods in swift without reference cycle

限于喜欢 提交于 2019-12-12 21:15:31
问题 My goal is to create a class which contains an array. The elements of the array will be the methods of the same class. like: class MyClass { lazy var functions = [self.myFirstMethod, self.mySecondMethod] deinit { print("Deinit") } func myFirstMethod() { // Do Something } func mySecondMethod() { // Do Something } func executeAll() { for f in functions { f() } } } When I call the executeAll() it works fine and I achieve my expected result: var myObject = MyClass() myObject.executeAll() The