Because neither your Python example (in Python 2), nor Kotlin, are Unicode correct, and you didn't even notice because it looks too simple/innocent to be wrong.
The Python example is correct in Python 3, but it's O(n)
performance. Any algorithm that entailed doing string slicing O(n)
times, presuming that each slice is O(1)
, just became an O(n^2)
algorithm, and you didn't even notice. You could replicate this behaviour in Swift by definition custom subscript operators on String
, but you'll run into the same pitfall. There's a reason it was purposely omitted in the Standard Library.
Besides, that's not how you would write that in Swift. Depending on whether you need to slice characters (most common in front end work), utf8 or utf16 code points (most common if you're doing low level storage management, or communications protocols like BLE, etc.), you would make an array using let a = Array(s.characters)
, let bytes = Array(s.utf8)
, etc. Then you would do all your slicing operations, which are now O(1)
in the character case, because the character splitting has already been done once. Once your done all your slicing, you commit your changes by converting the array back into a string (String(a)
).
I certainly think so, although to be fair I did write it and am therefore completely biased. As cost is the issue, you have two options that will help. First, if you download my free Natural Swift video (https://gumroad.com/l/natural-swift), you’ll get regular book discounts sent to you by email. The discounts aren’t huge - only $5 - but every little helps. Second, I sometimes run larger sales (half price), so if you don’t mind waiting a few months then do so.
I use DarkSky API, you get 1000 free api calls a day and each additional call is $0.0001. I also use ForecastIO cocoapod to easily download and parse the JSON. It’s probably the easiest and cheapest I’ve found
Honestly, Storyboard is probably one of the best and easiest to use UI designers that I've used. If you REALLY don't want to use Storyboard then you'll have to use xib files or just code the whole UI. That however does make it quite a bit more difficult.
In your case it is probably the best to stick with Storyboards, since they are relatively easy.
You can also read this stack overflow thread if you want more information about the alternatives to Storyboard.
However, the real problem here is that you probably don't understand constraints well enough to work efficiently with them.
The Swift team is more-or-less reimplementing Foundation in Swift with Swift 3.0.
source: https://swift.org/about/#platform-support
That should negate any bridging related performance issues ... still I'm kind of curious about the issues you were running into with bridging as I've found it sufficiently performant for hundreds of thousands of objects in my apps. Not that I'm using a lot of JSON, but definitely a lot of bridging.
Just quick info that I just installed Swift and clang flawlessly using the supplied instructions on the popular Linux Mint 17 distro. I thought it should work well enough with the Swift Ubuntu 14.04 binaries given that this distro is based on that LTS release, and sure enough... :)
Now I'm hunting for a syntax highlighting text editor. It still feels kind of alien that this is even possible, and resources like these are still scarce for obvious reasons. :D It'll quickly get much better, of course. I think I'll go with Visual Studio Code. It gives me better performance than Atom.io, and I kind of like it especially now that it got its Marketplace. It also, surprisingly, comes with built-in Swift support, although (so far?) rudimentary.
My God... Visual Studio Code... Swift... Both on Linux. What is the world coming to!
You can use an iOS VNC client to connect to screen sharing on your mac. This gives you an image of the Mac desktop on the iOS screen, with the ability to translate iOS taps into Mac keystrokes and mouse-clicks.
If you want to write programs to do it, you can turn on Remote Apple Events on the Mac in System Preferences > Sharing, and send AppleEvents over TCP to the Mac from iOS.
If you can't find the spec for remote Apple Events, you can write a Mac program that advertises itself over Bonjour and accepts messages over WiFi or Bluetooth, then the Mac program performs actions on the Mac.
You can even use the build in apache web server on macOS, and write a small Swift CGI to perform the actions.
The author misses the most important features: Core Libraries. https://swift.org/core-libraries/#foundation
I think we can all agree that as of now swift is mainly a iOS language (which results in ~80% of posts in this subreddig being about iOS development).
If swift had a good (cross platform) standat library (like Go for example) the language adoption would skyrock. Simultaneously swift could reduce/drop ObjectiveC dependencies (like the NS[NextStep]) - like mentioned in the post. This is important because no new swift programmer will care about ObjectiveC... And they shouldn't...
I implemented your algorithm in Swift but without all the temporary storage, and it passed just fine at HackerRank
import Foundation
let nm = readLine()!.split(separator: " ").map{Int($0)!} let n = nm[0] let m = nm[1] var arr = Array(repeating: 0, count: n) for _ in 0..<m { let line = readLine()!.split(separator: " ").map{Int($0)!} let (a, b, k) = (line[0], line[1], line[2]) arr[a-1] += k if b < n { arr[b] -= k } }
var curr = 0 var max = 0 for i in 0..<n { curr += arr[i] if curr > max { max = curr } }
print(max)
Firestore / Firebase Realtime DB are meant to connect directly to your mobile app, so the traditional wisdom of "your client shouldn't interact with the database directly" is mostly wrong. Instead, both Firebase products have security rules (here are links for Firestore and Realtime DB) that you're supposed to set up to ensure that clients are only reading / writing the data that they should be.
I think there is a problem with making HTTP requests to a server in this particular instance. Firestore and Realtime DB are meant to be realtime solutions, meaning that the client doesn't refresh or re-request data when the app is running, it just "magically" receives updates from the server. If you make HTTP requests, you lose this functionality, and you'd have to replicate it yourself using sockets, but I think that's all more work than it's worth. Properly defined security rules should solve the problem.
The senior dev's comment on Swift being a "safe/server language" is kinda senseless. Swift is a safe language in the sense that it's statically typed, has memory safety, optionals, etc. and it's also a server language in the sense that you can build web backends with it, but that has little to nothing to do with whether or not Swift code should connect directly to a database. If your app's database was, for example, a PostgreSQL instance, it would be a horrible idea to let the app connect to it directly, and Swift's memory safety and applicability as a server side language have nothing to do with that. It's just plain bad practice to let clients have unrestricted access to the database, regardless of the language the clients are built with.
You're getting the error because you are missing a }
before your else
. You also have an error in that there is no such thing as an else do
in Swift and the alert
value won't exist in your else
block even if you fix that.
It's clear from this bit of code that you aren't familiar with the Swift language at all. Do yourself a favor and read through the documentation before trying to do too much with the language.
Lol sorry but I just noticed that nobody had ever asked the question before when I tried googling it across reddit, stackoverflow etc. And I tried to search in the swift manual but didn't know it was called a keypath. Tried to cmd+F search \ in documentations like swift.org but couldn't find an easy explanation.
I had this problem for months on different machines, a MacBook Pro and a Mac Pro. When the simulator runs, it switches your audio config into "Call Mode" by activating your microphone. I have no idea why, but here are two solutions:
When I started working on the Mac Pro I discovered that it doesn't have an internal microphone, so my old little trick didn't worked anymore. If you're not using headphones and just want the audio coming from your laptop to be good, then solution #2 will do the trick.
As someone who almost went crazy because of this problem, I wish you good luck!
App sandbox can be easily extracted from phone backup. No jailbreaking, just standard backup and a free tool.
Also, "Please remember this Pass Code" does not fit in smaller screens (iPhone SE 2016). You might want to enable word wrapping on those labels.
I wrote a whole book on server-side Swift called, cunningly, Server-Side Swift. If you bought any of my previous books (or if you download my free Natural Swift video) you'll get a $5-off coupon on that book and others.
I was using UrbanAirship. They used to be free for up to 1,000,000 pushes / month, but then they decided that they had to do more than push notifications. They ended up charging an INSANE amount of money for what we needed (I think they should have kept their original offering and added to it instead of removing something that just worked).
As such I'm now using AWS's SNS service (https://aws.amazon.com/sns/). It's been pretty fantastic so far. Quick to integrate, and best of all adds no dependencies to the apps themselves!
They're also 1,000,000 free pushes / month, then $0.50 for each mill thereafter.
I did this with a little app I wrote for some friends and distributed it through Testflight. They had to provide me an email address which I then added into my developer account under testers, then they could install the app through Testflight.
https://developer.apple.com/testflight/
I believe you have to be at the $100/year developer level to do this.
Not sure if you are aware, but there is already a project called flask which is a python web microframework and is quite well established. Might want to consider a different name to avoid confusion (and help with SEO)?
Swift really isn’t that different than the other C-style languages out there. Most of your programming knowledge will carry over.
I’d start with the official documentaion, there are some good links there. After that there’s the Stanford course and other various courses and books.
Truthfully, I don’t know many of the more popular courses out there because I’ve done quite a bit of C, C++, Java, and Objective-C programming and I was able to pick up Swift mostly from the official documentation and libraries. Other people will take other paths to learn the language, I’m sure.
Good luck on your learning! If you have any programming questions then post them here and I’ll help if I’m able, as will others.
Looks like you're on Swift 1.2, rather than Swift 2. You can get the beta here. Swift 1.2 changed Strings to Ints with .toInt()
, I think, like this:
"1".toInt() // 1?
Swift 2 changed some of those conversion methods to functions, but they work the same other than that. This works fine for me (I'm on Swift 2) at any rate:
var possibleNumber = "1" var convertedNumber = Int(possibleNumber)
I started learning swift on the Treehouse website about a month ago and I'm already up to the lesson of creating my first app, it has been great so far and I was a complete beginner. I tried some other video lessons but I liked these better because in the video they walk you through each step on Xcode while you follow along and then they have a code test for you to practice as you learn. You can make your boss pay for it since he wants you to learn it. https://teamtreehouse.com/learn-swift
While an early 09' Mini will likely meet the system requirements for El Capitan, you'd have to upgrade it to 2GB+. If the purpose of this machine is solely for development, then I'd recommend 4GB. However, I would not recommend an 09' mini either way. Core 2 Duo computers are still quite usable with developing in Swift, but only with the right upgrades and system tweaking. That machine is 6 years old now.
If you take your time with shopping on eBay, you could acquire a 2013 MacBook Air 13" for ~$600 in good condition and that'll have a fast SSD, 4GB of RAM, good graphics and a much better processor as opposed to an 09 Mac mini. This also has the added benefit of a backlit keyboard, display, mobility etc. Hooking it up to one of your monitors is also easy.
If your goal is to spend the least amount of money as possible, you could get an 09 Mini on eBay for $250 with 4GB of RAM. I would then recommend purchasing a 120GB SATA 2 SSD which shouldn't be very expensive ($60-80?). This would make for a decent dev machine.
For full disclosure, I have bought and sold Apple computers on Craigslist and eBay for 5-6 years and have used them for a bit longer. I currently use the base 13" MacBook Pro retina from late 2012, but I am expecting a 15" MacBook Pro retina 2012 that I got on eBay for $900 in excellent condition to come in soon. I have been using Xcode for a few years and have made a few games.
I hope this helps. Best of luck getting into Swift!
I prefer Swift when starting new project since the syntax of Swift is cleaner and less unnecessary code syntax -> Less typing -> Rapid development ;D
However, in some situation, during developing Proxyman.io, I have to select Objc when dealing with C and C++ codebase since it's easier to deal with it. Majority of awesome system libraries are written in C, for instance, #include <libproc.h> is good one to get the pid and manipulate it in high performance.
Was it this problem? https://www.hackerrank.com/challenges/crush/problem
I haven't looked at that one yet. But looking at the Leaderboard tab for it and filtering to just Swift submissions, there are plenty of people who scored the perfect 60/60 on it, which means that it's certainly possible to implement it efficiently enough in Swift to pass all the tests without timing out on any of them.
JetBrains CLion with their Early Access Swift plugin on Linux.
Kind of bleeding edge, but it does work; I'm using it myself.
There is unlikely to be a viable option for Swift on Windows in the foreseeable future. Perhaps someone will make it work with cygwin but they're not going to have an easy ride.
Edit: just saw elsewhere in the thread that you want to make an iOS App. This is an entirely different ball game to just compiling Swift (Swift != iOS) and frankly even the most cursory of searches online would have told you the same thing: iOS App Development is, practically speaking, IMPOSSIBLE unless you are running OS-X.
Honestly, see the number of people who asked this same question over and over, you're not going to get a different answer just because you really want it :-) If you are lucky with your PC's hardware configuration, you may be able to run OS-X, in which case, use Xcode - search Hackintosh.
Depending on what kind of traffic you're looking at, the hosting will probably be pretty cheap. For example, if you go with Digital Ocean's 5 dollar a month plan you're looking at 300 bucks over the next five years (and you'd most likely have plenty of bandwidth to host other things on the server).
You could also take a look at heroku, which offers a free tier: https://www.heroku.com/pricing
I might be able to help a bit more if you can provide more details on what the app will be doing.
If you’re learning pure Swift without iOS, there are lots of online options for writing and running Swift code. This is one of the best:
If you want to learn iOS, then you need a Mac. MacInCloud is a good service for a Mac virtual machine you can log onto remotely, and pay monthly:
Create apps and share them with friends or release them on the app store. It doesn't have to be "the next big thing".
I recently did a online course on mobile app development and what I realized is that tutorials are one thing and actually making apps is something else. When making an app on your own you get errors and exceptions which you'll have to do some research on stack overflow to fix them and this is where you'll learn the intricate details of any programming language. Some apps you could try to build are:
1.) A weather app which interacts with a weather API eg openweathermap (free) gets user's location (coordinates) and shows them the weather at their location.
2.) A simple online shopping app where users can view products and add items to cart
3.) A fast-food restaurant app where users can create an account, login, view a menu and create an order
​
It doesn't have to be a complete application but just give it a shot. You'll discover lots of gaps in your knowledge by doing this but you'll learn a lot too.
For vector graphics I have switched from Adobe Illustrator to Affinity Designer. Though I missed a couple of features initially, I have no regrets. It's a great tool. $50 one time payment instead of a subscription.
Affinity Photo is currently in (free) Beta, so you might want to check that out too.
just take a look at tonymacx86 they give great advice on building a mackintosh PC if you have an Intel processor. If you have an AMD it is usually possible to but involves a lot more "hacking" on the system, but I'm sure Google could help in that case :P
Yes and no.
>Can I learn Swift Programming without Macbook?
Yes, you can. You can install Swift on a computer which runs Ubuntu (download it here) to learn Swift. The programming language isn't tied to iOS or macOS programming, and you don't need macOS to learn it.
>Please guide me I am interested in iOS Development.
For that part you'll need Xcode. Keep in mind you don't have to have the latest Macbook model for that :-) All you need is a Macbook capable of running the latest macOS version (so you can install the latest Xcode).
Your problem has nothing to do with whether it is applicable or not. The second sentence here is “code is read far more than it is written”: if your coworkers can't read it, don't write it. Gradually educate them and explain what's good about that style.
You should not start to use it just because it's cool and you are excited about it, you need to show why it is better that way.
Someone a year ago wrote big chunk of code and then left the company, now you inherit their code and have to maintain it and fix bugs. How would you feel if that code was in Prolog of Visual Basic because that was what they liked?
Coding tests really depend on the company. My experiences are all based on junior interviews.
I've had interviews where the assessment was basically talking about the different APIs of Swift. e.g. How does TableView work under the hood, what is so special about enums in Swift, what is swizzling etc...
I've had interviews where the interviewer also asked me questions unrelated to iOS: What's the difference between a Java Reference and a C Pointer.
As for coding assignment/test, that one company had an online test where I could upload my project within 4 hours after starting it. I had to create a http request to some endpoint they gave me in the test, decode the json and then filter/process the data. The hard part was the processing of the data - I had to come up with an algorithm, figure out edge cases and see if the time complexity is reasonable.
So, depending on the company, I'm pretty sure the test will include at least some parts that require algorithmic thinking. If you're not doing that already, it won't hurt to solve some easy questions on https://leetcode.com/. If your interviewer asks you about the time and space complexity of your algorithm (worst case of course), you should definitely know them - If I interviewed someone and they don't know the basics of algorithm analysis, it would raise a red flag for me.
Basically the same as for any good piece of code. It should be readable, short functions, small classes especially view controllers, not too much indentation. I think Uncle Bob Martin's Clean Code still is a very good book to read even if it's about Java.
Amateurs do the following generally in iOS:
The easiest way to go (removing as many hurdles from here to writing your first lines of code) is to just fire up your browser and start coding javascript.
Get your head around the basic concepts about programming. After that perhaps start to take a look at ios coding.
http://www.codecademy.com/tracks/javascript is a good place to start.
:)
I have another Swift book in the works right now that I want to release before I update HWS or Pro Swift. I haven't announced it yet, but will do soon!
The Swift 3 changes in Xcode 8 beta 2 mean I'll need to issue an update for Practical iOS 10 addressing what's changed, and that will happen on Thursday.
Are you new to programming? I guess yes, from your post. Sorry, if I speculated wrong.
Stanford course is not beginners. The course requires good programming experience (say beginner level) and also knowledge of object oriented programming. Do note that this course is not meant to teach you programming.
If you are completely beginner, I suggest you to learn basics of programming and object oriented programming. Language doesn't matter, pick any. I prefer Python (javascript is also a good choice). Or you can do with Swift also. build something using those. apply concepts of OOP. Once you are completely comfortable, start with Stanford course.
If you already know programming, please ignore my earlier advice.
Stanford's course is really really good. It only teaches you iOS APIs, building apps but also doing the things right way. Using swift to fullest (which courses on Udemy or other tutorials severely lack imo.)*. The course is NOT about game or graphics dev. I am at lecture 12 and I can surely tell you it's not about game or graphics dev, but its about building iOS apps.
Lecture 10 starts with Tableviews and continues. Next couple of lectures include ~~Core Map~~ Map Kit (which required location based apps). So I can certainly say you can build a yik-yak clone, easily. Don't give up the course. It's really really good. And do all the exercises. Hope this helps. If I have not answered your question, please ask/clarify.
edit: I forgot about Udacity. They too have fine course on iOS and its free. Its less advanced than Stanford and pretty small. May be you could try that before Stanford course. And Kunal is a great teacher. Here's the link - https://www.udacity.com/course/ud585
* for example, Paul makes use of property observers in a really nice way. Udemy courses just introduce the concept, but hardly seem to use it when its apt to do.
Xcode is just IDE but it supports Core Data http://www.raywenderlich.com/934/core-data-tutorial-for-ios-getting-started, because it is apple's framework for storing data.
Lately I have been using Realm https://realm.io/docs/swift/latest/ and to be honest I find it faster and simpler. There is less to do to make it work. In the URL that I gave you , you will find everything that you need to start.
I'd offer another vote to check out Realm. I've been using it lately, and the dev shop I am at has been using it in a few recent projects and it has been pretty slick.
Before playgrounds and Swift I used this app to try out little snippets. https://coderunnerapp.com
Just including it in case your follow up question was going to be “so, if no playgrounds then how do I run little snippets”
Are you using OS X for Swift development? If so, you could give it a shot using the Time Profiler instrument in Xcode.
> I know this probably makes only a minor difference but I would feel better knowing it in detail :)
Then this little bit of advice probably isn't what you're looking for, but my thought is that it probably doesn't matter – at least until you notice a performance impact.
In JS, certain things can make an impact because it can be difficult to squeeze performance out of a single-threaded in-browser runtime. In a lower-level language like Swift, there are usually more abstract optimizations (at least in application code).
If you wanted to get into the real nitty-gritty (for fun and learning), you could try compiling a simple Swift file with certain flags, comparing the compiler's output (from highest to lowest level):
-emit-sil
to see what the difference is the Swift Intermediate Language-emit-ir
to see what the difference is in LLVM IR-emit-assembly
to see the difference in actual assemblyAlso, I'd bet that you'll see big differences depending on the type of the constant/variable. Is it a struct that never escapes the local scope and can (though is not guaranteed to) be allocated on the stack? Or is it a class instance that needs to be allocated on the heap and deference-counted?
At the end of the day, there are many variables (no-pun-intended), which is why I'd say don't worry too much about it until you have a performance problem. But I'd love to hear what you find from an academic perspective!
As to the point about the standard algorithms used in interviews, you can do the free mini-course associated with the book Cracking the Coding Interview on the site HackerRank.com. Most of the tasks in that course are available in Swift, so you can play along with their test cases (though I did use C for some that weren’t at the time available in Swift.)
I used those to brush up on those standard algorithms before a coding interview with Amazon, and nailed all of the coding stuff. Literally every question they asked for coding tests was from that material. I very much didn’t do well on the interview questions where I was expected to not roll my eyes or say “for fuck’s sake” when talking to them; your mileage may vary.
On the other hand, I have a friend who did one of those boot camp style courses, and he has a job in the field after completing it. He’s working with Node.js, which sounds like hell to me, and frankly I don’t think the code he writes is any good, but he is gainfully employed. Like the commenter to whom I’m responding, I would likely hire a self motivated amateur who applied the skills learned from coding test sites and YouTube videos to various interesting projects (especially if I can see it on Github) than one who came out of those programs.
You might as well use Firebase Crashlytics: https://firebase.google.com/docs/crashlytics/
I can't see Google keeping the old Fabric Crashlytics around for much longer now that they're offering a migration path.
If you have a struct or class called User in your app, it will compete for Firebase's User class. You'll need to refer to a firebase user by using it's module with Firebase.User. Check the migration guide for more info on the changes they made.
There is no native functionality in Xcode for that. In the past I used Doxygen on Objective-C, but it does not support Swift. Looking at Jazzy, it does not seem to have that feature, but maybe it's hidden in some option.
I am not aware of any other tool. If you want to do it manually, I use Omnigraffle.
Just go pick up a copy of Clean Code by Bob Martin. Sure, it is in Java but the principles will apply to almost any language.
Keep you functions short. Don't copy code. Wrap gnarly bits in other functions or classes (like CLLocationManager).
It it takes you longer than a couple minutes to understand what some code is doing then rewrite it (and if you still can't read it then comment the crap out of it)
Google it!
Seriously though, I've been using tonymacx86 as a reference for years now. They have some really useful build guides up on there, as well as step-by-step guides on how to install the OS onto your machine. The folks over at /r/hackintosh are also really helpful.
I found this link over here:
https://news.ycombinator.com/item?id=9137936
I'm submitting it because I think it's an interesting look at the tree of protocols behind the common integer types in Swift.
However, as I commented on the Hacker News link...
> To summarize, the author has two minor problems:
> 1. Bit shift is not part of the IntegerType protocol, when it should be.
> 2. Construction from a UIntMax bit pattern is not part of the IntegerType protocol, when it should be (done correctly, this addresses the author's sign and construction complaints)
> The author incorrectly claims that these are problems with generics or protocols or the diversity of integer types in Swift. They're really a problem of minor omissions in the standard library that are forcing some very cumbersome workarounds.
Lets hope Apple keep tidying up some of these standard library issues.
I get inspiration from design sites. Designers, in general, love sharing what they do, so there's a ton of content out there. I most commonly look at dribbble, but also search sites like Pinterest (search for iOS 9 app design, or something along those lines)
JSX is an HTML-ish template language embedded in the javascript language when using the React transpiler. You can read more about it here:
https://reactjs.org/docs/introducing-jsx.html
For example, with JSX if you wanted to declare a template that returned, say, a header title, you might do something like this:
function render() { return <h1>Hello world</h1>; }
The compiler translates that into something like this:
function render() { return React.createElement('h1', 'Hello, world!'); }
SwiftUI resembles the bottom with some syntactic sugar coming from the new version of Swift to make it less constructorish. SwiftUI does not have anything like the top, at least not so far as I have seen.
Regarding the IDE, of course that's not part of the actual compiler features and library, but I guarantee that you will not get the same refactoring and live-preview features that XCode has from any Atom-based editor, or Sublime for that matter. Maybe Jetbrains will update AppCode to do something similar, but it wont be for months if not a year or two until that happens.
Ideally, you'd want the server to be the gatekeeper to the DB to prevent unauthorized access.
Flow would go like this:
If you just need a basic API server, I suggest using Node with Express to get up and running quickly.
There are tons of resources. i would suggest picking some free videos on youtube/udacity/udemy and start playing with xcode 7+ and then see if you need a paid course.
I would recommend these
I learnt swift after i purchased devslopes udemy course beginner to paid professional. its really good. now he has a kickstarter campaign going on and that will give you lifetime access to all courses and updates so you would be covered if apple comes up with something new.
https://www.kickstarter.com/projects/912791163/devslopes-anyone-can-learn-to-code?ref=discovery
I have also heard this is pretty good.
It's just a good general-purpose text editor. Although, interestingly enough, both it and swiftstub.com are based on the Ace editor. Atom is pretty extensible, but until Swift itself gets Windows support, there's not much it could offer on that platform apart from syntax highlighting.
I actually really like the http://bitfountain.io/ courses. Especially with the swift course, they do a magical job of balancing depth and speed, taking you from what something as basic as what a variable is to full and complex applications surprisingly efficiently.
Just googled for a coupon and found this: https://stacksocial.com/sales/the-complete-ios-8-developers-course-w-swift-pre-release
TLDR: If you want to make an Apple App. Swift is an excellent place to start.
If you are not completely invested in iOS or Mac app development I would not recommend Swift as a first language. For the sole reason that the code you write can't be deployed anywhere else (easily). That's not to say that you can't translate the skills to other languages. If you are set on wanting your first apps to be on iOS/Mac then I think it's safe to say Swift is the better place to start. Swift is more modern and more user friendly (more forgiving) to a beginning programmer. It's still growing and you will find a lot more resources for Obj-C but Apple is fully committed to Swift. So it probably will help you future proof your skills.
I would also recommend this app for Mac. https://coderunnerapp.com/
It's a no bs way to play around with a lot of different coding languages. Implement simple command line programs without having to worry about installing anything. Try swift and obj-c or even java (better yet all of them) and write simple programs. Like a calculator or task manager. See what language you feel comfortable in.
Honestly the "best" programming language and environment is the one that you feel the least amount of friction in. Friction is anything that comes between your idea and the finished product. Some people find the least friction with vim and C++. Others find the least with javascript and http://codepen.io/pen/ or sublime text. Pursue what's interesting to you and find the path with the least friction.
Good Luck!
P.s. /r/learnprogramming
You need to find a copy of Xcode 8 (latest version), use the converter to move to swift 3, then open in Xcode 9 and move to swift 4 (since they’re quite similar anyway). Then correct any errors that show up. Does the app have any Swift libraries from 3rd parties? You might have to search for updates ones/update abandoned ones yourself.
When all errors are cleared and things build successfully, click Archive in the Product menu. When the organiser pops open, choose Submit to App Store and follow the instructions. Then here’s Apple’s TestFlight page that contains a tutorial.
LLVM has piles of documentation on the subject of their subset of C++. The root of that is here. It wont teach you C++ though. I recommend reading that document and going to find some common components like the frontend, the parser, or SIL, etc. and seeing how it’s applied.
I learned C++ from reading Bjarne’s book and the standard which I recognize is not going to work for everybody. If you’re more of a visual/auditory learner, then talks at BoostCon/CppCon, C++ Now, and on MSDN are a very valuable open resource. If you’re more of an experiential learner, I recommend struggling with a [Starter Bug](goo.gl/AnmGTo) and picking up a feel for C++ as you go along.
According to this blog post, you also need to install Ninja. The recommended way to do this is to install Visual Studio 2019, which is a separate IDE from Visual Studio Code.
When we talk about Swift and package managers we're talking about installing packages of code (libraries, frameworks, etc.) into our projects so that we can use that code to build programs. With RubyGems you're talking about installing both code and complete programs.
So right now, in Swift, you install packages on a per-project basis and not on a per-system basis like in RubyGems. You also only install code packages, not application packages.
Now, if you want something more like RubyGems et al. you are looking for something like [APT](https://en.wikipedia.org/wiki/APT_(Debian\)). There really isn't any major application package distribution program out there that's specific to Swift.
If what you are asking is how to use the Swift Package Manager then the instructions can be found at the link I gave you. Here's a more specific link:
For Swift 4 and later you can pretty much use any Mac that can run macOS High Sierra. An SSD would be nice, as would at least 8GB RAM.
Although compile times will be longer for older Macs you really won't see much difference until your project gets extremely complicated. While you're learning you can use just about any valid system without too much annoyance.
This does feel more swifty. One note: the API design doc indicates that group
implies a mutating function. You'd probably want grouped
for a non-mutating version that returns a new dictionary. I haven't really looked at the SE group's patterns, but they may actually want both a non-mutating and a mutating version defined.
The Swift API guidelines suggest that functions named like imperative verbs should be mutating, and that non-mutating counterparts should read like nouns or verbs ending in -ed/ing.
Thus, your trimmed()
makes sense, as it returns a trimmed version of the string. But camelize()
, latinize()
etc should be renamed to their -ed counterparts for consistency. capitalize()
doesn't capitalize the string (mutate it), but returns a capitalized copy.
This was actually the Cocoa naming convention. The draft API design guidelines of Swift 3.0 instead encourages nouns for protocols which model a matter, and adjectives ending with -ing
, -ible
and -able
for protocols which describe capabilities.
You should be able to find it here:
https://developer.apple.com/xcode/resources/
See:
>Additional Downloads
>Get the latest beta and older versions of Xcode. To view downloads, simply sign in with your Apple ID. Apple Developer Program membership is not required.
>Beta Versions of Xcode >Command Line Tools & Older Versions of Xcode
for...in
loops only work over SequenceType
s. So that would be things like arrays:
for x in [1, 2, 3, 4] {...
Or sets, or whatever.
The count
property of numbers
is just an integer, not a SequenceType
. What you're looking for is a Range
of Int
. You construct a Range
using ...
or ..<
. So this:
for x in 1...5 {...
Is the range of 1 to 5. Or, in your example, what you want is:
for x in 0..<count(numbers) {...
The difference between ...
and ..<
is that the first includes the last number in the range, while the second doesn't:
1...3 // 1, 2, 3 1..<3 // 1, 2
Since indexing starts from zero, 0..<count(numbers)
will give you the indices of numbers
.
One caveat here: the above is Swift 1.2, which you should really be moving away from. Swift 2.0 is pretty much out of beta by now, and a lot of the things you might learn in Swift 1.2 won't work in Swift 2.0. You can get the Xcode 7 GM Seed (the Xcode with Swift 2.0) here.
Just as an example of some of the things that have changed, count
isn't a global function anymore, it's a property on CollectionType
s. So you get at it like this:
numbers.count
rather than this:
count(numbers)
Also, there's a new property on CollectionType
s: indices
, that actually does all of the range-making for you automagically:
for x in numbers.indices {...
HTH
Hi, I'm a developer at Sounds (www.sounds.am). I recently added a messenger feature to the app based on Firebase. The DB is structured like that: https://ghostbin.com/paste/nquv9
There is probably a lot of ways to improve my DB structure but it's working well (and we have 1 million monthly active users using it).
If you do not have much experience, I would recommend you to go with Treehouse. They have a cool iPhone/iPad app as well, so you can learn anytime anywhere.
https://teamtreehouse.com There is a 30 days free trial, so give it a shot and you will see if it helps :)
Here is an example of someone doing that through the treehouse tutorial that kid mentioned - https://github.com/tordasnes/Snapchat-clone and here is the tutorial https://teamtreehouse.com/library/build-a-selfdestructing-message-iphone-app
I've taken about 5 different courses including the Stanford. If you are willing to pay, the best courses to get you on your feet are https://www.bitfountain.io/ and/or https://teamtreehouse.com/ . They're both subscription based, but well worth what you pay for imo.
What about extracting super classes? Extracting or in-lining methods? Change function signatures? Move members up from a subclass to a super class or interface? Move types between files? A simple find and replace does not do any of that.
Checkout what Resharper can do: https://www.jetbrains.com/resharper/features/code_refactoring.html
I tend to:
Sketch some UI ideas out. Used to do this on paper but use my iPad Pro now. You can get basic wireframe templates quite easilly
Depending on:
I’ll either do it straight in IB and tweak on the fly, or for the ones I am less sure about (more complicated flows, experimental UI, brand new App idea) I’ve been using Sketch + InVision (craft plugin) . This allows you to take it straight from Sketch and run it on a device in a limited but good-enough-to-test kind of way
This link shows a short video of how easy it is to use Sketch + InVision
https://www.invisionapp.com/blog/build-interactive-prototype-sketch/
I learned a few interesting bits and pieces from CodeWars (coding kata). I still get the most value from a good book, blog or YouTube tutorial followed by a small project to put it into practice though.
You’re confusing two very different things.
Your images are uploaded to Cloud Storage, yet you’re trying to access them through Firestore, which is a database, not a storage service.
Go look at the actual Cloud Storage’s docs here: https://firebase.google.com/docs/storage/
The scope of the iOS development I'd say is a lot more broad. I love doing iOS development and that's what my field is. I can't stand doing web development for a lot of the reasons you've mentioned.
There are still instances where companies or customers will want to try the new buzzy technology of the day(React Native, RxSwift, etc) but at the end of the day you still need to open up XCode and know how to write Swift(or Objective-C).
UIKit for the most part is pretty well made and so is Swift generally, your main hurdles will probably be accounting for hardware limitations and new things like tableViews, the lifecycles of apps and other things that are more unique to mobile development.
I think your knowledge of web will be beneficial to you when you start doing backend related work for an app and that LAMP stack might come in handy.
If you want to really see how great iOS development is though take a look at how easy it is to connect a Firebase database to an iOS app :)
Also, not the only consideration, but you'll make a hell of a lot more money doing iOS dev over web Dev on average.
Good luck!
Firebase Auth has an "anonymous sign-in" feature that will let you create a Firebase user without requiring the user to sign in. This will still let you use all the features of FirebaseDatabase or Firestore with authentication, but no sign in required from users.
You can find the documentation here on how to use it.
Disclaimer: I work on the Firebase Core iOS SDK.
Your best option in my opinion is Firebase. It is incredibly easy to use, is pretty customizable, and (I believe) just recently got support for photo storage, and notifications. There may be other options, but this is what I use and I love it.
I am working on a cryptocurrency tracker as some of you have have seen since I post here sometimes.
After getting a ton of requests on these two features, they are now live on app store.
It is now possible to favoritemark currencies in the toplist to make them sorted to the top so that you as a user don´t have to scroll all the way down to what you´re interested in.
It is also possible to enter the average cost of which you bought your currencies at to track the profit/loss of your portfolio.
I have also made the news a little prettier by webscraping the links I receive from google rss to get images.
As always, no sign up, no ads, no in app purchases and completely anonymous with firebase.
I´d love some feedback and suggestions on what you think can improve the app. Thanks :)
iOS: https://apps.apple.com/se/app/coincurrently/id1543974454#?platform=iphone
Android: https://play.google.com/store/apps/details?id=com.cryptium.coincurrently&hl=sv&gl=US
Please read Clean Code. At least the first chapter until error management. This by itself will improve your code quality by a lot. Trust me on this. Or trust the whole programming community for which this book is considered the Bible of coding
It's fairly easy to implement on your own server with a scripting language, but there's a bit more to it than just sending the push. You'll want server-side code to track push tokens linked to user accounts. This way you can send a push to a single user (or specific group of users).
You'll also want to track errors returned if a push failed. This could be because the app has been reinstalled, the OS has been reinstalled, the phone is out of range, or something as simple as turning notifications off then on again (which invalidates the old push token). Even if sending blanket messages to all users you'll want to have the ability to take a token off the list so it doesn't get a notification the next time around.
If it all looks like too much work there's always Amazon's Simple Notification Service (https://aws.amazon.com/sns/).
Did the video use a Playground? I think this is normal output for a Playground. "_lldb_expr_328.Deck" is the internal name for deck
See the link for more info: https://stackoverflow.com/questions/30303410/empty-class-in-swift-playground-gives-lldb-expr-error
If you have time to spare, machine learning is a pretty interesting course on Coursera. I know you said AI, but maybe Machine Learning is of interest.
Many existing projects are public on GitHub or GitLab. If you find something you like and want to help, and have the capability to, you can open a pull request. Learning Git, which is a version control system, would be very useful for this. Reading through this link would be quite useful to get down the basics, at least: https://git-scm.com/book/en/v2. It’s very useful for any sort of collaborative projects, regardless of if they’re in Swift or not!
> And sorry if my English wasn’t perfect.
Your English is better than many native English speakers I’ve seen :)
For Apple hardware you should better hold on until October when the rMBPs and maybe even the Mac Minis will finally be updated.
I have a hackintosh and the current rMBP 15. If you pick one of the so called golden builds (http://www.tonymacx86.com/buyersguide/august/2016) the hackintosh is a relatively seamless experience - updates straight from the App Store, no issue publishing apps, etc. Mine is essentially a 2011 iMac 27", apart from the GPU.
Most of the information you shared is irrelevant. Unknown exception crashes can happen in a billion ways.
The only thing that matters here is the reason for the crash. In the massive chunk of code you put here, I can see here that you shared that.
So, let's see:
reason: '[<MyApp.ViewController 0x7fc265531de0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key staticDataSource.'
Your class is not key value coding-compliant. Let's google that.
It looks like you could potentially have a number of problems. The most probable ones are bad connections, @IBOutlets that were deleted,
What I would do is make a new project, only using the functions where you got the crash. Figure out where it went wrong. I'm guessing you're using a tableView, with the functions:
cellForRow
numberOfRows
numberOfSections
Think logically, and Google everything. Due to lack of information, I wasn't able to solve your problem but I hope you can go somewhere from this. Feel free to ask me anything if you have any questions. Good luck!
Here you go, this what the company required for an interview:Try it out its a really practical exercise in stuff you will really do if you are looking for a job in app development.
Code Exercise : RSS Feed Reader
Write a news app based on the Google News RSS feed (http://news.google.com/?output=rss). The app should launch into a table view with: • An image (or place holder image) related to the story. • The title of the story • A short description from the story (first few words, abstract, etc) Clicking a row should take you to a second view that: • Have one image related to the story. • The title of the story • The story
Additional Requirements: • TDD is very important. Show us you know how to test your code. • We want to see what YOU can do but feel free to use any pods or frameworks needed. o Please include a README with any steps needed to start, and test your app. You can assume we have: • XCode • Ruby • Bundler • CocoaPods • Git If there are any other required tools or please specify or include a bundle or pod file.
• The app should cache data for offline use. • The app should be attractive if initially started in offline mode.
Here's an open source Hacker News client: https://github.com/NikantVohra/HackerNewsClient-iOS
The author posted a thread on Hacker News asking for some reviews of his code: https://news.ycombinator.com/item?id=9479657
I'm fairly certain OS X is free. You should be able to download it outright or borrow a friends and make a bootable flash drive. You can find more here: https://developer.apple.com/osx/download/. This is an old article but the premise is the same: http://www.makeuseof.com/tag/how-to-install-mac-os-x-on-a-pc-without-using-a-mac/
Also, If your close to a university you should check if they have a surplus. At my university they do public offerings and you can get past generation Mac Pro's starting around $125.
Usually, yes. You want to be very careful with system updates. I'd recommend going with a well-established build and wait for the community to test/figure out updates before installing them. Start here:
http://lifehacker.com/the-always-up-to-date-guide-to-building-a-hackintosh-o-5841604
And the guides / community at tonymac86.com are excellent:
Be prepared for a few glitches along the way; on my build, the green speaker port on the back of the PC doesn't work, so I plug my speakers into the front headphone jack, and getting the nvidia card drivers working took a little effort, and dealing with the boot interface is a little rough... but if you can live with that and are willing to troubleshoot, you can build astonishingly powerful hackintoshes for a fraction of what a full-configured mac pro would cost. (Plus you also have a good PC for gaming / etc when you want/need WIndows).
Interesting to hear that perspective. I was a long-time C programmer, and, while I have worked on embedded and also in assembly, I’ve almost always done it in higher-level languages. This was the sole exception (because we had to fit a driver on a smaller chip and someone had to do it).
I gave up on writing assembly after 6502, partly because I got tired of learning new chipsets, but also because I’m not a good enough assembly programmer for instruction pipelining.
That’s background for why I think learning Rust would be fun and cool, I just personally lack Rust-like problems I care to solve.
I thought it was a great start to learning the iOS development ecosystem. I was a web designer before starting, knowing the basics of HTML and CSS is helpful but not necessary.
There is a learning curve and I definitely got stuck sometimes. There are a ton of resources for when it gets confusing. My best advice is to just keep pushing and it eventually starts to click. You'll feel defeated for a little and the next day the solution seems obvious sometimes!
You can access all of Udacity's courses for free: Intro to iOS
The Nanodegree provides project feedback, community support, and career advice like resume and interview guides. I would say it's not a requirement to pay for the full course as 90% of what you want to learn is available for free!
Yes they are good. I'm currently on the Treehouse basic plan as I enjoy the freedom of switching topics. Their embedded compiler is helpful to get started and how I first learned Ruby.
Udacity's courses can all be accessed for free: Intro to iOS
While I enjoy their teaching style a little less than treehouse, they still provide a great curriculum to get started. The main benefit of paying for Udacity is project feedback. I would recommend treehouse for the price and they have a great course on learning Swift.
If you want to start programming, you can start some beginners course on Coursera, e.g that one. It will teach you basics of programming with Python. It may be a good starting point :).
I believe you can use appcode for windows. http://www.jetbrains.com/objc/ The catch is you have to have Xcode to test an app on a simulator or device, as well as to archive it to a .ipa file. Note: I’ve never used it myself but I read about it before
No Swift this year. I wouldn't hold my breath for Swift getting closer to Oculus in 2016 either. However, to be useful... spend a lot of time looking here: https://developer.oculus.com Then spend even more time digging deep here: http://unity3d.com/unity There's a great Unity 3D course on Udemy.com that'll teach you most of what you need to know to get going. Search for "Learn To Code by Making Games - The Complete Unity Developer"
This is interesting. If there is not a huge market for paid apps and most of the apps are free, then who is paying for the (I assume) hundreds of hours of development time for an average app? Do most iOS developers work for free?
According to indeed.com an average iOS developer earns $100k a year. Who pays for their time?
I am genuinely interested in the answer. I always wondered what is the business model for the very popular free apps. I assume they have whole teams of devs working on the app and the costs are probably running into millions of $ per year just for the salaries. How do they make money?
There are lots of ways you can poll and notify without having to do it yourself. Here's one way: You could set up a cron job that polls the remote service (makes a harmless call) and reports an error when the check fails. You could send yourself a text: http://osxdaily.com/2014/03/12/send-sms-text-message-from-command-line/.
EDIT to answer the second question...In terms of a unit test or integration test in Xcode, you should have a test that simulates the various failures the remote service could have: cannot connect to it, call fails and returns a failure code, call fails and does not return, etc. Your app should be designed to handle such failures and your test cases should check that your app handles them the way you want it to.
There was a lot of discussion about this question when Swift was first announced. The TL;DR is that both Swift and Rust are both in the same boat here: they both lack support for higher kinded types, making it impossible to create a complete Functor abstraction at this time.
https://news.ycombinator.com/item?id=7895504
That said, the following subthread describes the caveats around Functor in the Swiftz library:
Ha I just wrote about this, as a positive. Being able to get started with SwiftUI was a huge win over learning AppKit. I don't mind filling in the gaps as the app evolves.
I wrote a whole book on server-side Swift using Kitura, called Server-Side Swift. If you want to save a little money, you can download my free Natural Swift video and you should automatically get a $5-off discount code emailed to you.
My 2 cents
Whatever u do my recommendation will be to execute the project incrementally and get customer validation as early as possible
To turn this product into a business make sure all elements in BMC are addressed http://www.businessmodelgeneration.com/canvas/bmc