Questions tagged [swift4]

0

votes
0

answer
3

Views

Is markup formatting just for Swift playgrounds?

In swift file, I don’t see editor _ show rendered markup button. For example. //: - Experiment: //: Modify the anyCommonElements(_:_:) function to make a function that returns an array of the elements that any two sequences have in common. //: How can I show this in rendered markup mode in swift f...
John
1

votes
1

answer
1.2k

Views

Swift 4 Alamofire multipart upload not working

I am using alamofire 4.7 and swift 4 I need to upload image and json to server. I am using the following code below for uploading bu I am getting result failure but data is inserting in server but not getting response, showing some serialization error as something like this ▿ result : FAILURE: re...
Justin Mathews
1

votes
2

answer
166

Views

Swift - Splitting strings with regex - ignoring search string

There is a clever 1st answer given here for splitting swift string with a regex expression split string answer However it keeps the searched text within the array of answers. I'm trying to do a similar thing, but ignoring the characters acting as separators (e.g. just like the swift split function,...
domc
1

votes
3

answer
625

Views

The bundle UITests couldn’t be loadedbecause it is damaged or missing necessary resources. Try reinstalling the bundle

my pods are here # Uncomment the next line to define a global platform for your project platform :ios, '9.0' target 'myAPP' do # Comment the next line if you're not using Swift and don't want to use dynamic frameworks use_frameworks! # Pods for myAPP pod 'SwiftMessages' pod 'IQKeyboardManager' pod...
Jibran SiddiQui
1

votes
0

answer
9

Views

Facebook login for Swift 4

I'm trying to install facebook SDK using swift 4 (xcode version 10.1) and it doesn't work. The error says 'SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2. (in target 'FacebookCore')' 'SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2. (in target 'F...
Ignatius Ivan
1

votes
3

answer
497

Views

Converting Older KVO to Swift 4

I'm trying to convert some old WWDC swift code to Swift 4. I think that I have everything done, except for this last bit that does some KVO. This has been pretty difficult to narrow it down to this last bit because everything appears to function like the example code - but these KVO methods do not...
Perlguy
1

votes
2

answer
302

Views

change views height in Keyboard extension (iPhone X)

I have following problem: I build a keyboard extension, a alternative keyboard to the system keyboard. In all older iPhone models it works fine, but at the iPhone X it doesn't. My problem is, the height of the keyboard's view is decreasing from 216px (iPhone 8 ,8+ , ...) to 141px (iPhone X). Because...
swiftUser
1

votes
2

answer
83

Views

Parallelogram view using UIBezierPath

I am trying to create custom parallelogram view using UIBezierPath but not getting a perfect one. Following is my custom view code class CustomView: UIView { override func draw(_ rect: CGRect) { let offset = 60.0; let path = UIBezierPath() path.move(to: CGPoint(x: self.frame.origin.x + CGFloat(offs...
azhar
1

votes
1

answer
301

Views

Can UIApplicationOpenURLOptionsKey.sourceApplication be nil?

Recently after a new app update, we start getting crash in line let sourceApplication = options[UIApplicationOpenURLOptionsKey.sourceApplication] as! String in the following code. I am just wondering why it can be nil or is it crashing because of as! to string? func application(_ app: UIApplication...
kidsid49
1

votes
1

answer
308

Views

Xcode project keeps crashing after converting to Swift 4, “Class implemented in both…”

I recently converted an Xcode project to Swift 4. I fixed all the syntax errors. However, my app now crashes, after outputting an error message which starts Class MPExportableArtworkProperties is implemented in both... I have been looking around S/O but all I find is that its related to MapBox whic...
Jonathan Nairn
1

votes
0

answer
235

Views

After adding and updating sticky with stretchy header in tableView, its scroll becomes jerky

I am developing a custom tableView with stretchy headerView and it also has sticky headerView. I have successfully achieved it by updating its contentInset and contentOffset properties. But after updating its contentInset the scroll becomes jerky. Below is the code for the same: I have added below c...
Akruti
1

votes
0

answer
35

Views

TableView cellForRowAt iterates through all cells right after calling reloadData()

I used tableView alot and I know it well. but this time it works weird. I added this delegations to the class: UITableViewDelegate, UITableViewDataSource. I connected the delegates from storyBoard. cells showing currectly and everything is working fine but I wanted to add the pagination to my table...
Alfi
1

votes
1

answer
88

Views

How to search only for schools in Swift LocationPicker Library

I am using this library 'Location Picker' for ios swift. it basically search for places in the map, all kinds of places. Can I restrict the search for only Schools? I need to search for schools ONLY I am using swift4 and the latest xCode Thank you very much IBAction function @IBAction func pickAScho...
Hatim
1

votes
2

answer
842

Views

Completion handler never called

I have a function like this. class func getAccountBalances(completionHandler:@escaping ((_ balances:Any) -> Void)){ //Alamofire request and we get the result. But sometimes the result fails. switch response.result { case .success(let value): completionHandler(value) case .failure(let error): print...
Nevin Jethmalani
1

votes
0

answer
72

Views

Is there a way to cancel a Vision Framework request (VNDetectTextRectanglesRequest) once triggered?

I'm running a Vision Framework request for an iOS app like follows: let textDetectionRequest = VNDetectTextRectanglesRequest(completionHandler: self.findTextBoxes) let textDetectionHandler = VNImageRequestHandler(cgImage: image, orientation: orientation, options: [:]) DispatchQueue.global(qos: .back...
Andre Guerra
1

votes
0

answer
49

Views

How to make CollectionView cell height depend on total of all element height in the cell?

I know this question may asked so many time,but I still cant be understand on this.I very new in iOS developement,I come from Android. I have a CollectionViewCell look something like this: I set all the autoLayout for each element in StoryBoard. But the problem is the height of each element in each...
ken
1

votes
1

answer
215

Views

Hide a black fade when self.dismiss with CATransition

I want to make my viewController to dismiss to an old viewController with animation. But when I use CATransition my viewController and old viewController fades black. Is there any way I can make it not to fade? let transition = CATransition() transition.duration = 1.0 transition.type = kCATransition...
Dojyouge
1

votes
0

answer
29

Views

Efficiently pass core data objects to common detailViewController

I have a number of entities that describe different pieces of equipment. I read these into the EquipmentViewController. I'm struggling to figure how to use a generic EquipmentDetailViewController that can be used to show and update any of the different entities. I have it working by having a separat...
David DelMonte
1

votes
0

answer
79

Views

How do you implement a generic class factory in Swift?

I want to 'make' a number of class instances similar to a base class but different in underlying type. (Not quite the same as the typical 'Animal' class factory examples seen all over the net!) The code below is close to working but it requires the user to 'upcast' the make result, as in: var f1 =...
WholeCheese
1

votes
1

answer
129

Views

UIButton title inside UITableViewCell changes on reuse

I have a table view which has a data that consists of both phone contacts and facebook friends. the cell's button title should be 'Invite' if the user is a contact and 'Add' if it is a facebook friend. However, the titles on each button are wrong and are swapping on scroll. here is my model: struc...
rendell
1

votes
1

answer
586

Views

Upload multiple images to FTP server in iOS

I'm developing an application in swift 4. In it, I want to upload multiple images to FTP server. I have tried to do with https://github.com/Constantine-Fry/rebekka but could not build getting error saying Xcode 9 does not support building or migrating Swift 2.x targets. Also tried with https://gist...
RP89
1

votes
1

answer
30

Views

How can I increase performance

my app has a view that basically consists of a complex grid. There are roughly 1400 subviews. On 'modern' devices the transition to this view is fairly smooth - you notice a slight delay if you are looking for it. On 'older devices' such as an iPhone 6 the delay is more noticeable. It takes about a...
Joseph
1

votes
1

answer
46

Views

Long CoreData predicate to match multiple terms to attribute + relationships

I’m using swift 4, Xcode 9, iOS 11 I am continuing to learn about CoreData via tutorials and Q&A posts, but I can’t seem to figure out how to answer this question. I have a CoreData entity with one attribute and 12 relationships to different entities that each contain 1-3 attributes. This is bec...
Coltuxumab
1

votes
0

answer
75

Views

GraphQL Query for track order status in Shopify iOS

I am new in GraphQL and Shopify also. My requirement is track order status using shopify iOS SDK and i am unable to find any solution to track order status. I am able to get user's order list using this query { customer(customerAccessToken: token) { orders(first: 20) { edges { node { id orderNumber...
vipulk617
1

votes
0

answer
165

Views

Setting orientation for Google Mobile Vision face detector

I trying to get Google Mobile Vision to detect faces from a live camera feed. Since I am processing frames I need to set the orientation. The Google Docs say... The face detector expects images and the faces in them to be in an upright orientation. If you need to rotate the image, pass in orientati...
coder
1

votes
0

answer
164

Views

Trouble using UILocalizedIndexedCollation to filter a table view with the inputed user's name.

I'm new to this forum! I am having a little bit of trouble sorting my Person's array with the use of UILocalizedIndexedCollation. Code I created the following class: @objc class Person : NSObject { @objc var firstName: String! @objc var lastName: String! init(firstName: String, lastName: String) {...
ozark
1

votes
1

answer
264

Views

Open same View Controller

Using Xcode 9 / Swift 4, I have a tile application (same as Windows 10 presentation). When user is on main view controller and click on a tile, I want to open the same view controller and set parentId, in order to show child tiles. App can have infinite number of child of child. But, app crash when...
Florian Mac Langlade
1

votes
0

answer
957

Views

Making a HTTP POST request in Swift 4

I´m trying to send data to a PHP file on my server using URLSession. This seems to fail though, since no data is received on the server. While running the app, I get this console print: 2018-01-09 20:56:10.942359+0100 EinsatzPush[12182:8624757] [BoringSSL] Function boringssl_session_errorlog: line...
Nils
1

votes
1

answer
92

Views

What is considered too heavy for UserDefaults?

I'm building a simple iOS app that will be the first I'll have put on Apple's App Store. At one point, the app accesses the user's contact list and lets them select any number of contacts they want to save as favorites. For ease of building version one, I am currently using UserDefaults to save thes...
rtoken
1

votes
0

answer
170

Views

Adding review[] with google places details

Following the Google API documentation (https://developers.google.com/places/web-service/details) I'm trying to adding for the first time review[] with google places details in my custom table view cell, but it does not work. I already added other parameters like the website and phone number and bot...
fisherM
1

votes
1

answer
116

Views

Capturing raw image type in Swift

To capture raw images, I am setting this AVCapturePhotoSettings(rawPixelFormatType: kCVPixelFormatType_24RGB) But I am getting an invalid argument exception like as * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* +[AVCapturePhotoSettings photoSettingsWithRawPix...
1

votes
1

answer
105

Views

RealmSwift 3.0.2 and Swift4 issue

Using RealmSwift-3.0.2, Cocoapods-1.3.1, Swift-4.0.3, iOS-11.2, XCode-9.2 I am trying to create a Realm object (as I always did the last three years). But since Swift4, something seems off ! I get the following Error-message: libc++abi.dylib: terminating with uncaught exception of type NSException B...
iKK
1

votes
0

answer
179

Views

Customize iOS11 Document Based App Template

I need to do the following customizations on the provided iOS 11 Document Based App Template: A library with only my App files, as Procreate example App bellow Get rid of the sidebar browser, so I have a fullscreen that shows only my library. https://assets.procreate.art/video/home/mp4/block-10.mp4...
Alexandre Lordelo
1

votes
1

answer
55

Views

How to convert UInt16 into Integer

I am facing issue with conversion, I have 2 UInt8 byte and converted as UInt16 by using let testLiveSpeed : UInt16 let bytes: [UInt8] = [data[3], data[4]] //where data has contain array of `UInt8`, self.testLiveSpeed = UnsafePointer(bytes).withMemoryRebound(to: UInt16.self, capacity: 1) { $0.point...
Joyal Clifford
1

votes
1

answer
1.2k

Views

Fast tap gestures in Swift 4 and iOS 11

I just made a simple app to try out any type of gestures. I got to the tap gesture. So I thought, what if I made a fast tap game kind of application that counts the amount of taps the user performed. But soon enough I ran into some issues. It did not count all the taps. If I began to tap as fast as...
Arabig
1

votes
0

answer
54

Views

Audio Missing when Adding Text on pixelBuffer

I am trying to add text overlay on video, When recording in iPhone 5s or lower devices in High quality and writing text on that then after 1 or 2 seconds audio goes missing, But this doesn't happen on larger devices like iPhone 6/6s. If i remove that text writer method then it works properly on all...
Stark
1

votes
1

answer
830

Views

Take screenshot of ARKit view

How would I insert a button and use it to take a photo and place it in photo library. I have noticed when using arkit I cant drag buttons and place them over the view. I am seen some people online say you use snapshot() for taking the photo. import UIKit import SceneKit import ARKit class ViewContro...
Sam Burns
1

votes
0

answer
41

Views

SpriteKit Swift 4 changing all AnchorPoints

How can I in Xcode, Swift 4 in SpriteKit change anchor points of all objects located in my GameView they are on default set to x: 0,5 y: 0,5 (meaning that the anchor point is in the half of the height and in the half of the width of an object) and I can easily change anchor point of an single object...
janek_zapo
1

votes
2

answer
1.1k

Views

issues with UIView animation swift 4 Xcode9

I am trying to make an animation of a UILabel from off the screen to the center with a spring animation block. The first part of my code below in viewDidLoad() works perfectly, but when I add the animation block, it's like the code in the closure of the animation gets read first and it doesn't anima...
nicholasdmoore
1

votes
0

answer
77

Views

How to record video of a filtered UIImageView in Swift?

I have my camera's output going through a UIImageView's image so that a filter effect can be applied to it in real time. How do I capture the video output that I'm seeing in real time? I want to start recording for as long as I want, then stop the recording and have the resulting video stored somewh...
Chewie The Chorkie

View additional questions