Use this tag only for questions directly related to changes in version 3 of Apple's Swift programming language.

learn more… | top users | synonyms

5
votes
1answer
56 views

Project Euler solution #2 using Swift 3

I just wanted some review and opinions. Any better implementations or suggestions would be great. Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting ...
-1
votes
0answers
25 views

Swift 3 pod Alamofire 4.3 ObjectMapper 2.2 pod and AlamofireObjectMapper 4.0 [closed]

Here is the API response which I want to parse into the model file. API Response: Link ...
3
votes
1answer
50 views

Singleton class with custom initializer

In a Swift project, I have a class should be used as a singleton: ...
-5
votes
1answer
85 views

How can I clean my swift code [closed]

Here is my code . I am not sure is it best practice or not? Please help me to clean my code. I initial all value. Should O put all in optional ?. Is there any ...
0
votes
1answer
32 views

Simple HTTP API requests in an exam paper download app

So basically I am building an app that helps to download some documents via a rest api. Here is the SearchViewController ...
3
votes
1answer
43 views

Simple War game in Swift

I'm new to swift and I want to know if I'm doing something wrong or a harder way. I made a simple war game app. Tames of variables aren't correct, I know, but I was doing it quickly and I didn't worry ...
1
vote
2answers
72 views

Showing activity indicator (loading image) while processing in background

I have a login screen on my iOS app. When I click login button I want to make sure that user should be displayed a loading image in center of the screen. I found lots of different methods online but ...
3
votes
1answer
50 views

Optimal custom operator with generic type constraint for numerical type

I'm implementing (for an article) two custom infix operators: ¿% - to calculate percent of total %? - to calculate the percent ...
1
vote
1answer
61 views

Configure Table cell in model class

I'm trying to show data in UITablleView after getting it from an HTTP request. I heard that the best and professional way to do it is configure the cell and do the ...
3
votes
1answer
52 views

Transformations an array, combination of between map and reduce

I'm working on a function that reduces pairs of elements if they meet some criteria. For example, given an array: ["1", "2", "a", "b", "3", "4"] I want to ...
0
votes
0answers
78 views
4
votes
2answers
192 views

Basic calculator in Swift 3

I just started learning the basics to Swift 3 about 2 days ago. Since then, I've decided to make a simple calculator that can only do one operation at a time. I was wondering how efficient this was ...
4
votes
1answer
78 views

Extending CGPoint to conform to Hashable

For Advent of Code Day 1, I found myself needing to use a tuple as a key in a dictionary. Seeing that I can't extend tuples in Swift, I decided to extend CGPoint ...
2
votes
1answer
70 views

Listening to IOKit events with Swift 3

This is my first program in Swift/Xcode. The full source code and xcode project is available in GitHub. The part I would like reviewed is IOKeyEventMonitor.swift. ...
1
vote
1answer
59 views

Checking for required text fields for login

I wrote this script and it's working quite well however I think there's too much if else statements on it. How could I change them for a switch statement? ...
1
vote
2answers
65 views

Checking an authentication decision in a JSON response

I've been working on this login screen logic. It checks for the parameters in the JSON response to decide which action to follow. It works but it's kinda ugly and verbose. Any suggestions to ...
2
votes
2answers
161 views

Swift 3 Generic fetch request extension

I implemented an extension for the NSManagedObjectContext that takes any CoreData class as a parameter and performs a fetch request on it. I am new to CoreData ...
1
vote
1answer
69 views

UIAlertController and input validation

I'm refactoring some "old" Swift code using deprecated UIAlertView and delegates. I have a UIAlertController with an input ...
8
votes
1answer
210 views

Quickselect algorithm in Swift

I recently answered a question on Stack Overflow about finding the k-largest element in an array, and present my implementation of the Quickselect algorithm in Swift for review. This is essentially ...
2
votes
1answer
47 views
3
votes
1answer
248 views

Displaying JSON data from a server in a UICollectionView

This code pulls JSON from a server and delivers some data like imageURL, titleString and ...
0
votes
1answer
78 views

Extract regex matches with non matching parts

I want to check a string by using multiple search patterns and split the string at every occurrence. I'm using RegEx and it works fine. But I'm worrying about efficiency and performance. ...
0
votes
1answer
109 views

Accessing a UIView's parent UIViewController using the UIResponder chain

I recently found a static C function on Stack Overflow which returns a UIViewController reference from a containing subview using the responder chain: ...
8
votes
0answers
114 views

Water flowing swiftly over farmland – The August 2016 Community Challenge

This is my attempt to solve the August 2016 Community Challenge in Swift. I tried to implement the algorithm described by @200_success: Each Cell keeps track ...
5
votes
2answers
186 views

Postponed Prime Sieve in Swift

Motivated by this question, I looked out for other "infinite prime generators", i.e. functions which produce the list of prime numbers in increasing order and do not have an a-priori upper limit (such ...
1
vote
1answer
154 views

Unbounded Sieve of Eratosthenes in Swift

I've spent a while teaching myself Swift, and decided to take on the challenge of writing an unbounded Sieve of Eratosthenes to challenge myself. This is actually the first time I've written an ...