Swift Full Tutorial

0 views
Skip to first unread message

Cecelia Seiner

unread,
Aug 5, 2024, 12:24:58 PM8/5/24
to mapogyppau
Swiftis a new programming language developed by Apple Inc. for iOS and OS X development. It adopts the best of C and Objective-C, without the constraints of C compatibility. It uses the same runtime as the existing Obj-C system on Mac OS and iOS, which enables Swift programs to run on many existing iOS and OS X platforms.

This Swift tutorial will help you to understand Swift in a very easy and simple way. So that you can create your own Swift application or program. It will cover all the major concepts of Swift programming language which will boost your confidence and make you a good Swift programmer.


Swift is a modern and open-source programming language that is specifically designed by Apple for its platforms. It was introduced in 2014 with the aim of providing a language that is not only powerful and versatile but also provides great safety, performance, interoperability with Objective-C and modern syntax. So using Swift developers can easily develop robust and high-performance applications.


We can also use swift to develop software for phones, desktops, and servers. Swift is a great combination of modern thinking and diverse contributions from its open-source community. The Swift compiler is optimized for its performance and the language itself is tailored for its development.


We can also use Swift to create applications for Windows and Android due to its open-source nature and cross-platform compatibility. Cross-platform app development allows developers to write code and then deploy it on multiple platforms, for example, Flutter, React Native, and Xamarin. However Swift offers this versatility, the user experience may not be as seamless as that can achieved by using other programming languages such as C#, .Net, Java, Kotlin etc.


This tutorial is designed for software programmers who would like to learn the basics of Swift programming language from scratch. This tutorial will give you enough understanding of Swift programming language that you can take yourself to higher levels of expertise.


Swift is a powerful and general programming language that is used to develop applications for iPhones, iPads, MacOS desktops, Apple Watches and TVs. It can also run on Linux and Windows operating systems.


Double is a data type to store floating point numbers. It has a precision of at least 15 decimal digits. It is also known as a 64-bit floating point number. Due to its high precision Double is preferred by Swift as compared to Float.


you would think that with a framework as important as swift-nio and a platform as popular as AWS EC2 that there would be tons and tons of resources out there on how to do this! and yet, i could only find a single tutorial from raywenderlich.com on how to use swift-nio with EC2, and it is paywalled.


If I were you I would look at creating a docker image and then deploying on EC2 with Elastic Beanstalk. It massively simplifies the deployment, scaling and upgrading of instances and allows you to debug things locally within a docker container. It becomes a pain if you find a linux specific issue and then you have to open up SSH ports on your VPC to remote in, it's much easier to just run the docker container locally and debug that way.


First of all, I'd like to mention that I'm new to iOS programming, but not to general computer programming (I have some experience with Lua, so I know about flow charts, loops, variables, etc., just with another name)


I am following an Apple tutorial on creating an iOS Application using Swift [Developing iOS Apps (Swift)], and I have followed each step exactly as it is. This app has been running flawlessly in the Simulator, but some days ago it started throwing a SIGABRT error (I made a short research to understand what a SIGABRT (Signal Abort) error is, and I've even found some other answers, but no one seems to fix my problem).


The tutorial guides me to making a food-list app, called FoodTracker, using basic control from ViewControllers, Storyboards, etc. I would love to continue but this error keeps presenting each time I run the app. I have no Breakpoints in my code, I have cleaned the build folder some times, and I even ran the code using the Address Sanitizer (From the WWDC15 I saw that it helped at debugging...)


The error log is stating that the compiler does not see 'selectImageFromPhotoLibrary' defined in your code and a corresponding action or outlet connected on your storyboard. This is a very common error. The resolution is to go to the scene and open the Connections Inspector. Look through the list of outlets and actions for a matching name 'selectImageFromPhotoLibrary' and remove it if it exists. Then just reconnect that action or outlet to the code by performing a new Ctrl-Drag from the UIControl holding the reference to the code declaration of 'selectImageFromPhotoLibrary' in your corresponding code class. If this resolves the issue for you please remember to click the link below or feel free to edit your original question with clarifications.


I dragged the connection once as IBOutlet instead of IBAction (because I forgot to mark it as Action) and then edited it in the source to be IBAction and corrected it to be the same line as in the tutorial. But the problem is that XCode keeps the type stored somewhere. You can see this settings in the Connection Inspector. The way to get to the Connection inpector is to open the Main.storyboard layout, right-click the TapRecognizer icon at the top of the layout, this would then open a black drop-down with all the connections of that TapRecognizer control. There I had to click the small "x" mark and delete the connection of it as IBOutlet and leave just 1 connection as IBAction.


I am having a similair issue when I follow the swift tutorial. I have added a bar button item. Dragged it to create a segues and followed the instruction exactly (over an over agin) I have read you advice here. But I still get the following console output when I click on the add meal button in teh simulator...


I had renamed a button (not the IBAction func, just the button in the storyboard.) I tried to delete the IBAction and make a new connection, but it didn't work. Instead, deleting the button from the storyboard as well and adding a new one did.


By the way, I don't know what TapRecognizer is, so I right-clicked the View Controller icon (like a yellow stop button just above the main.storyboard layout) and it came up with a black menu. One of the objects had a small hazard sign next to it, which I deleted and that fixed the problem like you said.


I have referenced previous questions here to get code but it does not seem to work on my app.From these pictures below, you can see the setup of my storyboard and my didFinishLaunchingWithOptions function code.


ALSO, I tried programmatically loading my tutorial view controller every time I launch the app (so I removed the user defaults code) and that does not work either. When I did this, I simply get a black screen.


I'm new to swift, created FileMaker solutions for about 3 decades, tried (for several reason) to move to xojo - and became puzzled about changes there (almost all online-resources became out-dated, no longer helpful), although I created successfully some application with xojo


After the first step away from FileMaker to xojo, I got the gut feeling that a move to SwiftUI could be done (for me) - but I have problems finding a pure macOS doc or tutorial. All starts with iOS - and when stepping through the Apple tutorial, I got a bunch off errors, since I did not follow the first iOS steps. I solved that by following the iOS intro - but I wonder if there is any macOS tutorial available without producing errors after the first few steps (I was not able to set the schema, therefore a preview was not possible)


I am still (again) following the Apple tutorials - but it is quite hard since Apple wants the latest os - otherwise some methods won't work (and the error message is not very clear since one can read only that there is a problem with a parameter - the part about the os version was only visible after maximizing the window...)


Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.


I'm working through the Swift tutorial on using OAuth with Yelp and am getting a, "Cannot connect to the server." error when the code executes the 'oauth.authorize' function. I've checked everything carefully and my code follows the tutorial example exactly as far as I can tell (except, of course, I use my own client ID and client secret codes for Yelp). I can connect to the server manually via a browser, so the server is reachable.

3a8082e126
Reply all
Reply to author
Forward
0 new messages