Questions tagged [swift3]

1

votes
1

answer
527

Views

filter objects with two nested levels in a query with Realm

I have a model like this: class CalendarEvent: Object, Mappable { dynamic var exId = '' @objc dynamic var title:String = '' @objc dynamic var desc:String = '' dynamic var fullDate = Date() dynamic var date = '' dynamic var time = '' dynamic var location = '' dynamic var subcategory:Subcategory? dyna...
1

votes
2

answer
734

Views

Using selector in Swift 3 NotificationCenter observer

NotificationCenter.default.addObserver(self, selector: Selector(('uploaded')), name: NSNotification.Name(rawValue: 'uploaded'), object: nil) I was writing name: 'uploaded:' and xcode corrected it to the above code. The problem is when running the app i get unrecognized selector. Any one know how to...
user6520705
1

votes
1

answer
1.5k

Views

Why is Calendar.date(from: DateComponents) adding time?

I create an instance of DateComponents using the following code: let dateComponents = DateComponents( calendar: .current, timeZone: Calendar.current.timeZone, era: nil, year: nil, month: nil, day: nil, hour: 9, minute: 0, second: 0, nanosecond: 0, weekday: 2, weekdayOrdinal: nil, quarter: nil, weekO...
Loic Verrall
1

votes
1

answer
122

Views

SKSpriteNode in scene editor not using assigned custom class

I'm using Xcode 8.3.3. I made a custom 'Platform' class for some platforms. This is the first time I'm trying to use a custom class on a sprite made in the scene editor and for some reason the sprite just isn't using it. It seems pretty cut and dry, I setup a sprite with default settings in the scen...
genericguy25
1

votes
3

answer
409

Views

How to detect when user pressed the “allow” when user location is requested

I am creating an app which uses the user's current location. At first run, after the user is prompted to allow or deny the app to use it's location, I want to do stuff when the user pressed the 'allow' button. Is there a way to detect when the user has pressed the 'allow' button?
1

votes
1

answer
515

Views

Insert CAShapeLayer behind Image in UIImageView

Just as the title says. I have a UIImageView and I am inserting CAShapeLayers into the View. The issue is that I don't know how to insert them behind the image of the UIImageView. Any advice would be much appreciated, thanks.
Blue
1

votes
0

answer
99

Views

iOS Cell TextField Text Size Not Resizing When Scrolling Swift 3

I am having an issue when scrolling in a collection view cell. The text isn't resizing to fit based on the populated value and space available. In the image that isn't working as expected, I have scrolled down a 'page' or 2. In the set-up below, extraDetail1 seems to scales based on the first sca...
Jacksonsox
1

votes
0

answer
46

Views

Transferring Data from CollectionView inside TableView to a New ViewController

So I have a main ViewController that has Horizontal Scrolling CollectionViews inside a TableView. When you click on an Item in the CollectionView it transfers all the data from the Item to a new ViewController to display it properly. The problem I am facing is when you click on the item in the Coll...
Aman Chawla
1

votes
1

answer
136

Views

Swift 3 tableview.reloadData on main thread, not displaying cells properly

In a simple TableViewController i am calling ClouKit deleteRecord in a UIAlertController. // 2. When the user clicks OK. alert.addAction(UIAlertAction(title: 'OK', style: .default, handler: { [weak alert] (_) in LSCloudKit.shared.deleteRecord(record: login.toCKRecord(), completion: { (success) in le...
Pascal Duff
1

votes
0

answer
176

Views

On-demand resources - Force purge/clear of downloaded resource bundles

I have an swift4 app that is having certain issues where on-demand resources packages hang when downloading. The issue appears to be related to different versions of resource bundles being used in testflight environment as opposed to prod. Some users indicate that the packages do not download, but a...
Villainsoft
1

votes
0

answer
226

Views

CMMotionActivityManager queryActivityStarting data is not accurate

I want to list my activity for the last 24 hours but some of data I receive is totally irrelevant. For example when I'm sleeping and phone is completely in stationary state, CMMotionActivityManager returns the state as walking. Here is my code: aktivite.queryActivityStarting(from: Date.init().add...
Mehmet Kemal Bayer
1

votes
0

answer
38

Views

Showing green lines at right and bottom of recorded video using GPUImage2

I am using example from path: GPUImage2-master/examples/iOS/SimpleVideoRecorder GPUImage2 It records proper video and saving the file in camera roll without green lines using provided code in sample. Issue 1: Now, I have changed some properties in ViewController.swift like AVCaptureSessionPreset640...
Asif Raza
1

votes
1

answer
394

Views

Cordova plugin with Cocoapod dependency is not working properly

I am new to Cordova plugin implementation. I am creating a Cordova plugin that provides Web Socket support to the Cordova App. For Android platform everything is working fine. But for iOS, using Swift, I am stuck. For iOS (using Swift), to work with WebSocket, I am using SwiftWebSocket client librar...
KavitaDev
1

votes
1

answer
261

Views

Custom View Xib for MKAnnotationView button tap

I'm making a custom MKAnnotationView and i have a button inside the xib, inwhich i want to get when is touchedup inside. Although there are questions with the same issue, none of them is working with my code. I have the following. class CustomCalloutView: MKAnnotationView { var didTapGoButton: (() -...
Kwnstantinos Natsios
1

votes
0

answer
51

Views

Variable substitution in Swift 3+

Is it possible in Swift to do what I think of as meta programming. For example can I pass a variable in place of an object value. Say I have a constant struct called Colors which has several attributes like this: struct Colors { static let grayUltraLight = '#F2F2F2' static let grayLight = '#C4C...
Dan
1

votes
1

answer
265

Views

Swift 3 Line Chart Get Index

So Im making a graph using the Beautiful Charts Api. Im doing it in SWIFT 3. I got the graph working but now Im trying to get the selected value index, I have tried many things but they have not work. Heres my latest attempt at it. func chartValueSelected(_ chartView: ChartViewBase, entry: ChartDat...
Daniel Cisneros
1

votes
1

answer
575

Views

How to move from CoreData to Firebase

So currently, I am making an app in which it allows the user to create expenses and store them. Each expense has properties such as date, name, amount, type of expense, category and etc. Currently, I am storing all of this on CoreData, which I find is easy and manageable, however I really want to mo...
Arnav GUPTA
1

votes
0

answer
187

Views

iPhone X safeAreaInsets Dynamic from function

I'm using SnapKit for layout in my iOS project and in landscape mode i want to add some constraints at the bottom. with the following code everything works good. containerView.snp.updateConstraints { (update) in update.left.equalToSuperview().offset(58) update.top.equalToSuperview().offset(0) if #av...
Kwnstantinos Natsios
1

votes
1

answer
332

Views

How to ignore a remote/push notification while app is on background/terminated

Technologies Used: Firebase Cloud Messaging Swift 3.2 Xcode 9.2 To give you a background here's the data I'm sending via FCM on an api server { 'priority': 'high', 'content_available': true, 'alert': true, 'sound': true, 'registration_ids': [ '', '' ], 'notification': { 'title': 'SOME TITLE', 'body...
Zonily Jame
1

votes
0

answer
186

Views

Saving Siri INCreateNoteIntent in coredata

I know Siri is setup correctly, hence the image below. But the content is not saving in core data. Siri said it created the note, but it's not showing in coredata. This is what I tried so far, any help would be appreciated. class IntentHandler: INExtension, INCreateNoteIntentHandling { func handle...
Iam Wayne
1

votes
0

answer
75

Views

scroll for child View Controllers swift

i have a view that looks like instagram's home. scrolling should be like what you see in instagram but there is a problem with scrolling. when i try to scroll the view to down, only the collection view controller that is on the bottom scrolls and the top one sticks to where that is was. i tried to s...
nimafas
1

votes
1

answer
90

Views

Swift Youtube Player Memory Leak

I am using Swift-YouTube-Player library.Here is a link ! I am listing videos in tableview.My problem is memory problem. I know that I should clear all videoPlayer.clean() before loading selected videoPlayer. My question is how can i clear every instances of the player in my app is cleared before lo...
podgradle
1

votes
0

answer
75

Views

How to play youtube in portrait full screen mode when use WKWebView

I have upgraded to iOS 11.0.3 for my mobile phone. It seems before upgrading, I kind of able to play Youtube in portrait in fullscreen mode but now I was not able to do so. I am not sure which is which. In my code, I use the following in ViewDidLoad: let webviewConfiguration = WKWebViewConfiguration...
MilkBottle
1

votes
0

answer
32

Views

Firebase clousure is skipping itself for no reason

I am trying to observe single event via firebase. The address is correct there is no mistake that I am aware of. Please help me out. It skips whole code that is posted below. Database.database().reference().child('users').child(messagesWithId[indexPath.row]).child('metadata').observeSingleEvent(of:...
Jason Krowl
1

votes
2

answer
325

Views

How to present view controller from UICollectiveViewCell Class - SWIFT

I want to know how I can present a new view controller from 'didSelectItemAt - Method ' Please note that UIViewController is not a subclass so I don't have access to the navigationController to present the view controller. class FeedCell: UICollectionViewCell, UICollectionViewDelegate, UICollection...
Minon Weerasinghe
1

votes
2

answer
201

Views

Swift 3 - Function for Wrapping an Array

As I try to learn Swift 3, I am attempting to 'Wrap an Array of Elements'. In Swift 3 Playgrounds, I was able to implement code that wraps an array. My problem occurs when I try to create a function that implements my code. If you take the following code and copy-paste it to a Swift 3 Playground the...
1

votes
1

answer
45

Views

Swift3 how to catch all exceptions?

I'm debugging a table view in Swift3 and it complains about the number of rows. Because I know of no way to catch this exception, I'm forced to re-launch the project every time. How do I catch swift exceptions which do not throw errors, like the table view example below? do { self.tableView.reload...
Alex Stone
1

votes
0

answer
60

Views

how to create a zoom transition using custom navigation transition?

I'm new to navigation transition. I'm using Swift language for development. What i'm trying to do is, whenever user click on the tableview cell the new view will open and it look like it coming from the image view of the cell. I created a class of UIViewControllerAnimatedTransitioning. class Thumbn...
Sourav Mishra
1

votes
0

answer
441

Views

Simple Http Server Issue on Micropython (ESP8266)

I am sending same post to Simple Http Server(Micropython) installed on ESP8266 and BaseHTTPServer(Python) on PC from my mobile APP (iOS-Swift 4). On PC, i am getting Payload successfully as seen below, However, when i post to ESP8266, i am not seeing any payload in the body and after 3-5 request, i...
Sunrise17
1

votes
0

answer
709

Views

How to implement sticky section header in collection view in swift 4?

Here I am having sort and filter buttons which I need to make it as a header in collection view that to I need it like as sticky header view can any one help me how to implement this for this type of layout and below is my image for the grid layout and I tried by using this link but unable to implem...
User
1

votes
0

answer
95

Views

Why is init! still in Swift 4?

In Swift 3, IUO (implicitly unwrapped optionals) were modified such that assigning an IUO to an identifier with no declared type would have the type inferred as T? instead of T!. This also applies to init!. Because of this, it seems that for most accounts, init? and init! are semantically the same c...
edaniels
1

votes
1

answer
338

Views

Thread 1: signal SIGABRT from web view when accessing external link

I am currently trying to deploy a responsive website on mobile devices (iPhone & iPad) via a WebView. Here are some details regarding the app : the application's only purpose is to display the webView containing the website using the WKWebView component since UIWebView is deprecated in my environmen...
Tangela
1

votes
0

answer
101

Views

UItextview resize height for all devices with Keyboard Swift

I have one UIToolBar in top of Keyboard here is my code extension UIViewController: UITextFieldDelegate { func addToolBar(textField: UITextField) { let toolBar = UIToolbar() toolBar.barStyle = .default toolBar.isTranslucent = true toolBar.tintColor = UIColor(red: 76 / 255, green: 217 / 255, blue: 1...
Miloo
1

votes
1

answer
41

Views

Trouble understanding a for loop in Swift 3

I am studying some code to try to learn Swift 3. I came across this for loop and can't decipher what exactly it is doing. If you understand it, could you try to break it down with an explanation? var size = 0 var candidate = (value: 0, index: 0) for i in 0..
1

votes
0

answer
267

Views

ARKit - create world boundaries/get position at edge of visible plane?

Ok, what I am trying to do is create physics body/colliding boundaries for my character, my SCNNode, in my SceneKit game Im building with ARKit. This is so my node cannot move out of the user's vision/go so far away that it isn't visible as it is currently doing. My SCNNode is moved by user input, s...
skyguy
1

votes
3

answer
531

Views

Swift 3 - Get value from core data

I have a class that will take 2 inputs, Sets and Reps Using prepare(for segue: UIStoryboardSegue, sender: Any?) I passed the values back to the WorkoutViewController.Swift The data is successfully saved since after pressing save barbutton in the SetRepsViewController.Swift the window pops However...
IMan Merzaie
1

votes
0

answer
76

Views

how to fire local notifications on particular days rather than current weekday

I'm working on an Alarm app. While setting up the alarm, user selects days which are getting stored in an array. But I'm not getting correct weekday when trying to place the value while making notification. In my code I'm getting weekdays in 'daysValue' ([0,1,1,1,0,0,0], means alarm is set for monda...
Ankur sharma
1

votes
1

answer
895

Views

Xcode - No such module after importing framework

I have imported a framework to using Xcode 9 Swift 3 The code works well as long as I build the project for simulator devices However as soon as I select Gereric iOS Devices so I can Archive my project I get this error Can someone please help on what I can do to fix this issue?
IMan Merzaie
1

votes
1

answer
85

Views

convert ambiguous reference to swift 3

I am trying to convert to Swift 3 and receive the following error: '?' must be followed by a call, member lookup, or subscript My code: var superview = containerView.superview if type(of: superview?) === UIWindow.self { //I GET AN ERROR HERE superview = containerView } Suggestions?
The Architect
1

votes
0

answer
328

Views

Swift 3 Error: posix_spawn: error 13 When running Process command

I am writing a macOS app in Swift 3 that should run the command /usr/local/jamf/bin/jamf policy -id 20. I am consistently getting the error [9188:134113] [General] Couldn't posix_spawn: error 13. I am not sure what is causing this error, my guess is it has something to do with not being able to run...
Cameron Wilcox

View additional questions